Ruby on rails Rails:带有防护装置的Cucumber(+;spork和+;rspec)在更改时不运行功能

Ruby on rails Rails:带有防护装置的Cucumber(+;spork和+;rspec)在更改时不运行功能,ruby-on-rails,rspec,cucumber,guard,spork,Ruby On Rails,Rspec,Cucumber,Guard,Spork,我最近尝试安装Cucumber来补充我的测试环境。我已经让警卫与斯波克和Rspec完美合作了。我已经把一切都安排好了,现在可以运行了,包括Cumber,但有两件事情表现得有点古怪 第一期:当Guard运行Cucumber测试时,它会在打印“禁用配置文件…”后暂停约10秒。大约10秒后,它会完美地运行测试。 第二个问题:当我更改功能(存储在子目录中,如/features/users/sign_in.feature)或步骤定义时,guard不会运行测试。为了让我运行测试,我必须手动点击并继续运行所有

我最近尝试安装Cucumber来补充我的测试环境。我已经让警卫与斯波克和Rspec完美合作了。我已经把一切都安排好了,现在可以运行了,包括Cumber,但有两件事情表现得有点古怪

第一期:当Guard运行Cucumber测试时,它会在打印“禁用配置文件…”后暂停约10秒。大约10秒后,它会完美地运行测试。 第二个问题:当我更改功能(存储在子目录中,如/features/users/sign_in.feature)或步骤定义时,guard不会运行测试。为了让我运行测试,我必须手动点击并继续运行所有测试。显然,这违背了守卫的目的

以下是我的一些代码:

保护端子输出

ben@ben-K53SV:~/rails_projects/katmeer4$ bundle exec guard
16:51:57 - INFO - Guard is using Libnotify to send notifications.
16:51:57 - INFO - Guard is using TerminalTitle to send notifications.
16:51:57 - INFO - Guard::RSpec is running
16:51:57 - INFO - Running all specs
No DRb server is running. Running in local process instead ...
.....[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
........F....

Failures:

  1) User abilities admin Index Page 
     Failure/Error: it {should have_selector('div', text: 'delete')}
     Capybara::ExpectationNotMet:
       expected to find css "div" with text "delete" but there were no matches
     # ./spec/features/role_spec.rb:38:in `block (5 levels) in <top (required)>'

Finished in 1.18 seconds
18 examples, 1 failure

Failed examples:

rspec ./spec/features/role_spec.rb:38 # User abilities admin Index Page 


Randomized with seed 16984

16:52:08 - INFO - Starting Spork for RSpec, Cucumber
Using RSpec, Rails
Using Cucumber, Rails
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block...
Loading Spork.prefork block...
Spork is ready and listening on 8990!
Spork is ready and listening on 8989!
16:52:18 - INFO - Spork server for RSpec, Cucumber successfully started

16:52:18 - INFO - Running all features
Disabling profiles...
..
P-

(::) pending steps (::)

features/users/sign_in.feature:9:in `Then I see an invalid login message'

1 scenario (1 pending)
4 steps (1 skipped, 1 pending, 2 passed)
0m0.827s
功能/支持/env.rb

require 'rubygems'
require 'spork'

Spork.prefork do
end

Spork.each_run do
end

require 'cucumber/rails'

ActionController::Base.allow_rescue = false
begin
  DatabaseCleaner.strategy = :transaction
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Cucumber::Rails::Database.javascript_strategy = :truncation

您忘记将env.rb代码拆分为prefork和each_run块。尝试:

require 'rubygems'
require 'spork'

Spork.prefork do
  require 'cucumber/rails'
end

Spork.each_run do
  ActionController::Base.allow_rescue = false

  begin
    DatabaseCleaner.strategy = :transaction
  rescue NameError
    raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish   to use it."
  end

  Cucumber::Rails::Database.javascript_strategy = :truncation
end

嗨,丹,我做了上面的更改,但不幸的是Guard仍然没有注意到我对文件所做的更改(关于Cumber)。
require 'rubygems'
require 'spork'

Spork.prefork do
  require 'cucumber/rails'
end

Spork.each_run do
  ActionController::Base.allow_rescue = false

  begin
    DatabaseCleaner.strategy = :transaction
  rescue NameError
    raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish   to use it."
  end

  Cucumber::Rails::Database.javascript_strategy = :truncation
end