Ruby on rails 在Rails 4中,Guard没有更新测试计数
我刚升级到Guard 2,它告诉我有7个示例和7个失败 这是我正在处理的规范文件:Ruby on rails 在Rails 4中,Guard没有更新测试计数,ruby-on-rails,ruby,rspec,ruby-on-rails-4,guard,Ruby On Rails,Ruby,Rspec,Ruby On Rails 4,Guard,我刚升级到Guard 2,它告诉我有7个示例和7个失败 这是我正在处理的规范文件: # == Schema Information # # Table name: awardunits # # id :integer not null, primary key # nyaaid :string(255) # name :string(255)
# == Schema Information
#
# Table name: awardunits
#
# id :integer not null, primary key
# nyaaid :string(255)
# name :string(255)
# address :string(255)
# district :string(255)
# contact :string(255)
# email :string(255)
# insthead :string(255)
# instheadcontact :string(255)
# datestarted :date
# allowedmem :integer
# remarks :text
# disabled :boolean
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe Awardunit do
before { @awardunit = Awardunit.new(nyaaid: "NYAA/N/WP0001", name: "Test Unit", address: "No. 50, Kalpitiya Road, Maradana", district: "Colombo", contact: "23232223", email: "abc@localhost.com", insthead: "Namal Kaluaarachchi", instheadcontact: "324234234", datestarted: "1/10/2013", allowedmem: "5", remarks: "" ) }
it { should respond_to(:nyaaid) }
it { should respond_to(:name) }
it { should respond_to(:address) }
it { should respond_to(:district) }
it { should respond_to(:contact) }
it { should respond_to(:email) }
it { should respond_to(:insthead) }
it { should respond_to(:instheadcontact) }
it { should respond_to(:datestarted) }
it { should respond_to(:allowedmem) }
it { should respond_to(:remarks) }
it { should respond_to(:disabled) }
it { should be_valid }
describe "when nyaaid is not present" do
before { @awardunit.nyaaid = " " }
it { should_not be_valid }
end
describe "when name is not present" do
before { @awardunit.name = " " }
it { should_not be_valid }
end
describe "when district is not present" do
before { @awardunit.district = " " }
it { should_not be_valid }
end
describe "when contact is not present" do
before { @awardunit.contact = " " }
it { should_not be_valid }
end
describe "when datestarted is not present" do
before { @awardunit.datestarted = " " }
it { should_not be_valid }
end
describe "when email format is invalid" do
it "should be invalid" do
addresses = %w[user@foo,com user_at_foo.org example.user@foo. foo@bar_baz.com foo@bar+baz.com]
addresses.each do |invalid_address|
@authentication.email = invalid_address
expect(@authentication.save).to be_false
end
end
end
describe "when email format is valid" do
it "should be valid" do
addresses = %w[user@foo.COM A_US-ER@f.b.org frst.lst@foo.jp a+b@baz.cn]
addresses.each do |valid_address|
@authentication.email = valid_address
expect(@authentication.save).to be_true
end
end
end
end
在7个示例中不包括顶级测试!一个问题是,当我向spec文件添加一个新的descripe块并保存时,通常计数应该是8个示例。但卫兵仍然表现出7分!如果我转到另一个规范文件并保存它,guard仍然会根据旧文件说7个示例和7个失败!如何解决此问题
Guardfile
:
require 'active_support/inflector'
notification :libnotify
guard :rspec, notification: true, all_on_start: true, cmd: 'spring rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
# Custom Rails Tutorial specs
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
["spec/routing/#{m[1]}_routing_spec.rb",
"spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb",
"spec/acceptance/#{m[1]}_spec.rb",
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
"spec/requests/#{m[1].singularize}_pages_spec.rb")]
end
watch(%r{^app/views/(.+)/}) do |m|
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
"spec/requests/#{m[1].singularize}_pages_spec.rb")
end
watch(%r{^app/controllers/sessions_controller\.rb$}) do |m|
"spec/requests/authentication_pages_spec.rb"
end
end
Gemfile.lock
:
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.0)
actionpack (= 4.0.0)
mail (~> 2.5.3)
actionpack (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
activerecord (4.0.0)
activemodel (= 4.0.0)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
annotate (2.5.0)
rake
arel (4.0.1)
atomic (1.1.14)
bcrypt-ruby (3.0.1)
better_errors (1.0.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.1.4)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
coderay (1.0.9)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
debug_inspector (0.0.2)
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faker (1.2.0)
i18n (~> 0.5)
ffi (1.9.0)
font-awesome-rails (4.0.0.0)
railties (>= 3.2, < 5.0)
formatador (0.2.4)
guard (2.1.1)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rspec (4.0.3)
guard (>= 2.1.1)
rspec (~> 2.14)
hike (1.2.3)
i18n (0.6.5)
jbuilder (1.5.2)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
libnotify (0.8.2)
ffi (>= 1.0.11)
listen (2.1.1)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25)
mini_portile (0.5.2)
minitest (4.7.5)
modernizr-rails (2.6.2.3)
multi_json (1.8.2)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
pg (0.17.0)
polyglot (0.3.3)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.0)
actionmailer (= 4.0.0)
actionpack (= 4.0.0)
activerecord (= 4.0.0)
activesupport (= 4.0.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.0)
sprockets-rails (~> 2.0.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.1)
rails_stdout_logging (0.0.3)
railties (4.0.0)
actionpack (= 4.0.0)
activesupport (= 4.0.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.0)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.6)
rspec-expectations (2.14.3)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
sass (3.2.12)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
slop (3.4.6)
spring (0.0.11)
sprockets (2.10.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (1.3.0)
coffee-rails
tzinfo (0.3.38)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
annotate
bcrypt-ruby (~> 3.0.0)
better_errors
binding_of_caller
bootstrap-sass
capybara
childprocess
coffee-rails (~> 4.0.0)
factory_girl_rails
faker
font-awesome-rails
guard (~> 2.1.1)
guard-rspec (~> 4.0.3)
jbuilder (~> 1.2)
jquery-rails
libnotify
modernizr-rails
pg
rails (= 4.0.0)
rails_12factor
rb-inotify
rspec (~> 2.14.0)
rspec-rails
sass-rails (~> 4.0.0)
sdoc
spring
turbolinks
uglifier (>= 1.3.0)
GEM
远程:https://rubygems.org/
规格:
actionmailer(4.0.0)
actionpack(=4.0.0)
邮件(~>2.5.3)
actionpack(4.0.0)
动态支持(=4.0.0)
生成器(~>3.1.0)
erubis(~>2.7.0)
机架(~>1.5.2)
机架测试(~>0.6.2)
activemodel(4.0.0)
动态支持(=4.0.0)
生成器(~>3.1.0)
activerecord(4.0.0)
activemodel(=4.0.0)
activerecord-已弃用的查找程序(~>1.0.2)
动态支持(=4.0.0)
arel(~>4.0.0)
activerecord-Disprecated_查找程序(1.0.3)
activesupport(4.0.0)
i18n(~>0.6,>=0.6.4)
小型测试(~>4.2)
多重json(~>1.3)
线程安全(~>0.1)
tzinfo(~>0.3.37)
注释(2.5.0)
耙
阿雷尔(4.0.1)
原子(1.1.14)
bcrypt ruby(3.0.1)
更好的错误(1.0.1)
coderay(>=1.0.0)
erubis(>=2.6.6)
绑定调用方的调用(0.7.2)
调试检查程序(>=0.0.1)
引导式sass(2.3.2.2)
sass(~>3.2)
建造商(3.1.4)
水豚(2.1.0)
mime类型(>=1.16)
nokogiri(>=1.3.3)
机架(>=1.0.0)
机架测试(>=0.5.4)
xpath(~>2.0)
赛璐珞(0.15.2)
计时器(~>1.1.0)
子进程(0.3.9)
外国金融机构(~>1.0,>=1.0.11)
coderay(1.0.9)
咖啡轨(4.0.1)
咖啡脚本(>=2.2.0)
钢轨(>=4.0.0,<5.0)
咖啡脚本(2.2.0)
咖啡脚本源
execjs
coffee脚本源(1.6.3)
调试检查程序(0.0.2)
差异lcs(1.2.4)
erubis(2.7.0)
execjs(2.0.2)
工厂女孩(4.2.0)
activesupport(>=3.0.0)
工厂导轨(4.2.1)
工厂女孩(~>4.2.0)
钢轨(>=3.0.0)
伪造者(1.2.0)
i18n(~>0.5)
外国金融机构(1.9.0)
字体awesome rails(4.0.0.0)
钢轨(>=3.2,<5.0)
formatador(0.2.4)
防护罩(2.1.1)
formatador(>=0.2.4)
倾听(~>2.1)
伐木工人(~>1.0)
撬动(>=0.9.12)
雷神(>=0.18.1)
防护罩rspec(4.0.3)
防护罩(>=2.1.1)
rspec(~>2.14)
徒步旅行(1.2.3)
i18n(0.6.5)
jbuilder(1.5.2)
activesupport(>=3.0.0)
multi_json(>=1.2.0)
jquery rails(3.0.4)
钢轨(>=3.0,<5.0)
雷神(>=0.14,<2.0)
json(1.8.1)
libnotify(0.8.2)
外国金融机构(>=1.0.11)
听(2.1.1)
赛璐珞(>=0.15.2)
rb fsevent(>=0.9.3)
rb inotify(>=0.9)
伐木工人(1.0.4)
邮件(2.5.4)
mime类型(~>1.16)
树梢(~>1.4.8)
方法_来源(0.8.2)
mime类型(1.25)
迷你端口(0.5.2)
小型试验(4.7.5)
现代化钢轨(2.6.2.3)
多线程json(1.8.2)
nokogiri(1.6.0)
迷你端口(~>0.5.0)
pg(0.17.0)
polyglot(0.3.3)
撬动(0.9.12.2)
coderay(~>1.0.5)
方法\u来源(~>0.8)
坡度(~>3.4)
机架(1.5.2)
机架测试(0.6.2)
机架(>=1.0)
轨道(4.0.0)
actionmailer(=4.0.0)
actionpack(=4.0.0)
activerecord(=4.0.0)
动态支持(=4.0.0)
捆绑机(>=1.3.0,<2.0)
栏杆(=4.0.0)
链轮轨道(~>2.0.0)
轨道系数(0.0.2)
轨道服务静态资产
rails\u stdout\u日志记录
轨道服务静态资产(0.0.1)
rails\u stdout\u日志记录(0.0.3)
铁路(4.0.0)
actionpack(=4.0.0)
动态支持(=4.0.0)
耙(大于等于0.8.7)
雷神(>=0.18.1,<2.0)
耙(10.1.0)
rb fsevent(0.9.3)
rb inotify(0.9.2)
外国金融机构(>=0.5.0)
rdoc(3.12.2)
json(~>1.4)
rspec(2.14.1)
rspec核心(~>2.14.0)
rspec期望值(~>2.14.0)
rspec模拟(~>2.14.0)
rspec核心(2.14.6)
rspec预期(2.14.3)
差异lcs(>=1.1.3,<2.0)
rspec模拟(2.14.4)
rspec导轨(2.14.0)
actionpack(>=3.0)
activesupport(>=3.0)
钢轨(>=3.0)
rspec核心(~>2.14.0)
rspec期望值(~>2.14.0)
rspec模拟(~>2.14.0)
sass(3.2.12)
sass导轨(4.0.1)
钢轨(>=4.0.0,<5.0)
sass(>=3.1.10)
链轮轨道(~>2.0.0)
sdoc(0.3.20)
json(>=1.1.3)
rdoc(~>3.10)
斜坡(3.4.6)
弹簧(0.0.11)
链轮(2.10.0)
徒步旅行(~>1.2)
多重json(~>1.0)
机架(~>1.0)
倾斜(~>1.1,!=1.3.0)
链轮轨道(2.0.1)
actionpack(>=3.0)
activesupport(>=3.0)
链轮(~>2.8)
雷神(0.18.1)
螺纹安全(0.1.3)
原子的
倾斜(1.4.1)
计时器(1.1.0)
树梢(1.4.15)
多语言文字
多克隆(>=0.3.1)
涡轮链接(1.3.0)
咖啡架
tzinfo(0.3.38)
丑八怪(2.2.1)
execjs(>=0.3.0)
多重json(~>1.0,>=1.0.2)
xpath(2.0.0)
nokogiri(~>1.3)
平台
红宝石
依赖关系
注释
bcrypt红宝石(~>3.0.0)
更好的错误
绑定\u调用方的\u
引导式sass
水豚
子进程
咖啡导轨(~>4.0.0)
工厂女孩轨道
冒牌货
字体很棒的rails
防护罩(~>2.1.1)
防护罩rspec(~>4.0.3)
jbuilder(~>1.2)
jquery rails
libnotify
现代化铁路
pg
轨道(=4.0.0)
轨道系数
铷诱变
rspec(~>2.14.0)
rspec钢轨
sass导轨(~>4.0.0)
sdoc
春天
涡轮链路
uglifier(>=1.3.0)
问题是,Guard正在添加focus\u on\u失败:默认情况下为true
。在保护文件中,您必须添加focus\u on\u failed:false
。这是怎么做的
guard :rspec, notification: true, all_on_start: true, focus_on_failed: false, cmd: 'spring rspec' do