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

Tests are failing after first rspec run #13

Open
iRonin opened this issue Jul 19, 2012 · 5 comments
Open

Tests are failing after first rspec run #13

iRonin opened this issue Jul 19, 2012 · 5 comments

Comments

@iRonin
Copy link

iRonin commented Jul 19, 2012

My rspec tests are failing after first rspec run.
Color output is disabled after first run as well.
Tried with master just a second ago.

I get errors like the following for get and visit methods inside my tests:

OrderPagesController GET 'choose_plan' returns http success
     Failure/Error: get :choose_plan
     NoMethodError:
       undefined method `get' for #<#<Class:0xa8182c5>::Nested_1:0x469657c4>
     # ./spec/controllers/order_pages_controller_spec.rb:7:in `(root)'

I also get different output for test descriptions:

Order
  as a new record
    example at ./spec/models/order_spec.rb:22 # instead of the description from the first run

On other application in the second run I get the following error for VCR:

ERROR: Guard::JRubyRSpec failed to achieve its <run_all>, exception was:
NameError: undefined local variable or method `use_vcr_cassette' for #<Class:0x66d278af>

It looks like rspec doesn't recognize macros added by other gems.

@cfitz
Copy link

cfitz commented Aug 17, 2012

I'm having the same problem. Using jruby 1.6.7.2 in 1.9 mode doing jruby -S bundle exec guard

@jeremyjh
Copy link

Me too.

@patrickmcelwee
Copy link

I get this problem too using jruby 1.6.7.2 in 1.9 mode. There also seems to be a conflict with DatabaseCleaner, because on my second run (not my first), I also got errors about non-unique attributes when I created the same kind of object in subsequent tests. My DatabaseCleaner set up looks like this:

Rspec.configure do |config|
  config.use_transactional_fixtures = false

  config.before :each do
    if Capybara.current_driver == :rack_test
      DatabaseCleaner.strategy = :transaction
    else
      DatabaseCleaner.strategy = :truncation
    end
    DatabaseCleaner.start
  end

  config.after :each do
    DatabaseCleaner.clean
  end
end

@clupprich
Copy link

Same here. I've just updated to jruby 1.6.8, running in 1.9 mode. Had the same problems with jruby 1.6.7.2 as described above (including the DatabaseCleaner strategy).

@doxavore
Copy link
Contributor

I think I'm seeing the same issue. For me, it stems from the fact that my RSpec.configure block (from spec_helper) isn't being called between tests, since my spec file uses require 'spec_helper'. If I change it to an appropriate load (i.e. load File.expand_path('../../spec_helper.rb', __FILE__)) it will run on subsequent runs.

Since we only load the changed files (per

), I imagine we'll need to use load for spec_helper. But of course that's no fun. :)

Can anyone else confirm using load works for them, or am I running into a separate issue?

@jkutner Is this something you ran into, and why there are stubs for monitor_file around?

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

6 participants