Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard is not updating the test count #511

Closed
THPubs opened this issue Oct 27, 2013 · 6 comments
Closed

Guard is not updating the test count #511

THPubs opened this issue Oct 27, 2013 · 6 comments

Comments

@THPubs
Copy link

THPubs commented Oct 27, 2013

In my app, I just upgraded to Guard 2. Lets say Guard is telling me there are 7 examples and 7 failures. Here's the spec file im working on :

    # == 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

Its not including the top tests into the 7 examples! One problem... The other one is... When I add a new describe block to a spec file and save, normally the count should go to 8 examples. But guard is still showing 7! If I go to a different spec file and save it, guard still say 7 examples and 7 failures according to the old file! How can I fix this issue?

Here's my 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

The 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)
@rymai
Copy link
Member

rymai commented Oct 27, 2013

Hi, I thanks for the report. However, since this is related to guard-rspec, you should report the issue there.

Btw, have you tried with focus_on_failed: false?

@rymai rymai closed this as completed Oct 27, 2013
@THPubs
Copy link
Author

THPubs commented Oct 27, 2013

@rymai Thanks :) focus_on_failed: false did the trick! 👍

@rymai
Copy link
Member

rymai commented Oct 27, 2013

You're welcome!

@thibaudgg maybe focus_on_failed should be false by default, what do you think?

@thibaudgg
Copy link
Member

@rymai it was before, but I changed it because it looks quite fundamental to me :)

@rymai
Copy link
Member

rymai commented Oct 28, 2013

Yeah I know this has changed, all I say is that it's not the least surprising option IMHO (and not so fundamental to me ^^).

@thibaudgg
Copy link
Member

Yeah, we'll see if it creates more issues, that the first yet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants