Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用Spork和Guard时启动时出错_Ruby On Rails_Rspec Rails_Guard_Spork - Fatal编程技术网

Ruby on rails 使用Spork和Guard时启动时出错

Ruby on rails 使用Spork和Guard时启动时出错,ruby-on-rails,rspec-rails,guard,spork,Ruby On Rails,Rspec Rails,Guard,Spork,问题出在这里。添加了Guard gem后,当我调用Guard时,一切都很好。 当我添加Spork时,我得到了以下错误,该错误不会影响测试,但每次尝试重新启动Guard时都会出现 19:01:28 - INFO - Guard uses TerminalTitle to send notifications. 19:01:28 - INFO - Starting Spork for RSpec 19:01:28 - ERROR - Guard::Spork failed to achieve it

问题出在这里。添加了
Guard gem
后,当我调用
Guard
时,一切都很好。 当我添加
Spork
时,我得到了以下错误,该错误不会影响测试,但每次尝试重新启动Guard时都会出现

19:01:28 - INFO - Guard uses TerminalTitle to send notifications.
19:01:28 - INFO - Starting Spork for RSpec
19:01:28 - ERROR - Guard::Spork failed to achieve its <start>, exception was:
spec\u helper

require 'rubygems'
require 'spork'

Spork.prefork do
  # Loading more in this block will cause your tests to run faster. However, 
  # if you change any configuration or code from libraries loaded here, you'll
  # need to restart spork for it take effect.
  # This file is copied to spec/ when you run 'rails generate rspec:install'
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  # Requires supporting ruby files with custom matchers and macros, etc,
  # in spec/support/ and its subdirectories.
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|
    # == Mock Framework
    #
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
    #
    # config.mock_with :mocha
    # config.mock_with :flexmock
    # config.mock_with :rr
    config.mock_with :rspec

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
    config.fixture_path = "#{::Rails.root}/spec/fixtures"

    # If you're not using ActiveRecord, or you'd prefer not to run each of your
    # examples within a transaction, remove the following line or assign false
    # instead of true.
    config.use_transactional_fixtures = true

    # If true, the base class of anonymous controllers will be inferred
    # automatically. This will be the default behavior in future versions of
    # rspec-rails.
    config.infer_base_class_for_anonymous_controllers = false
  end
end

Spork.each_run do
  # This code will be run each time you run your specs.

end
这是一个,您可以通过添加以下内容来使用以前版本的
ChildProcess

gem 'childprocess', '0.3.6'
到您的
Gemfile
或尝试guard spork master分支,该分支通过将以下内容添加到您的
Gemfile

gem 'guard-spork', :github => 'guard/guard-spork'
运行

bundle exec guard
而不是

guard

为我修复了它

将GEM文件更新为“guard spork”、“1.4.2”,并为我修复了它。

您没有提供太多信息。但是,请看一下此rails铸件,按照它一步一步地,你应该没有问题运行与spork守卫。你还需要什么其他信息?我看了一眼火车司机;我添加了spork和guardwhat's spec helper是什么样子的?在问题中添加了spec_helper添加spork后,您运行了bundle安装?介意张贴你的警卫文件吗?太好了,非常感谢。我最终使用了gem'guard-spork',:github=>'guard/guard-spork'也帮助了我,在Mac上运行最新的Mountain Lion。谢谢。这已在guard spock 1.4.2上解决,因此您可以更改为gem“guard spork”,“1.4.2”。我更新了我的gem文件以使用
gem“guard spork”,“1.4.2”
,并修复了该问题。谢谢@leolobato!我从Gemfile中的guard spork中删除了版本(1.2.0),运行了bundle更新,将其升级到1.5.0版本,并为我解决了相同的问题。
guard