2013-10-27 4 views
0

Я только что обновился до Guard 2, и это говорит мне, что есть 7 примеров и 7 сбоев.В Rails 4 Guard не обновляет счетчик тестов

Вот файл спецификации я работаю над:

# == 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: "[email protected]", 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[[email protected],com user_at_foo.org [email protected] [email protected]_baz.com [email protected]+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[[email protected] [email protected] [email protected] [email protected]] 
       addresses.each do |valid_address| 
        @authentication.email = valid_address 
        expect(@authentication.save).to be_true 
       end 
      end 
     end 

    end 

Его не включая топ тестов в 7 примеров! Одна проблема. Когда я добавляю новый блок описания в файл спецификации и сохраняю, как правило, счет должен перейти к 8 примерам. Но охрана все еще показывает 7! Если я перейду в другой файл спецификаций и сохраню его, все равно скажут 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) 

ответ

0

Проблема заключается в том, Guard добавляет focus_on_failed: true по умолчанию. В файле Guard вам нужно добавить focus_on_failed: false. Вот как это будет выглядеть следующим образом:

guard :rspec, notification: true, all_on_start: true, focus_on_failed: false, cmd: 'spring rspec' do 

Решение: https://github.com/guard/guard/issues/511

Смежные вопросы