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

Repeat tests not passing when using w/ capybara/rspec - #<NoMethodError: undefined method `background' for #<Class:0x203d2643>> #19

Open
mariszin opened this issue Nov 13, 2012 · 4 comments

Comments

@mariszin
Copy link

Hi!

When using guard-jruby-rspec for model testing, everything works as expected - when saving a file, tests are run.
But there's an issue w/ capybara/rspec integration tests - You can only run the tests once.
When running repeat tests, You get the error:

#<NoMethodError: undefined method `background' for #<Class:0x203d2643>> 

The corresponding helpers are not included in the test case.
Here's the test case:

require 'spec_helper'
feature 'FunctionalZone' do
  ap self.included_modules
  background do
    ...
  end
  ...
end

When running the test for the first time, this is the list of the included modules:

[
    [ 0] Capybara::RSpecMatchers,
    [ 1] Capybara::DSL,
    [ 2] Capybara::Features,
    [ 3] RSpec::Rails::RequestExampleGroup,
    [ 4] RSpec::Rails::Matchers::RenderTemplate,
    [ 5] RSpec::Rails::Matchers::RedirectTo,
    [ 6] ActionDispatch::Integration::Runner,
    [ 7] ActionController::TemplateAssertions,
    [ 8] ActionDispatch::Assertions,
    [ 9] ActionDispatch::Assertions::TagAssertions,
    [10] ActionDispatch::Assertions::SelectorAssertions,
    [11] ActionDispatch::Assertions::RoutingAssertions,
    [12] ActionDispatch::Assertions::DomAssertions,
    [13] ActionDispatch::Assertions::ResponseAssertions,
    [14] RSpec::Rails::RailsExampleGroup,
    [15] RSpec::Rails::Matchers,
    [16] RSpec::Rails::Mocks,
    [17] RSpec::Rails::FixtureSupport,
    [18] ActiveRecord::TestFixtures,
    [19] RSpec::Rails::TestUnitAssertionAdapter,
    [20] RSpec::Rails::SetupAndTeardownAdapter,
    [21] RSpec::Matchers,
    [22] RSpec::Core::MockFrameworkAdapter,
    [23] RSpec::Core::SharedExampleGroup,
    [24] RSpec::Core::Let::ExampleMethods,
    [25] RSpec::Core::Let,
    [26] RSpec::Core::Pending,
    [27] RSpec::Core::Subject::ExampleMethods,
    [28] RSpec::Core::Extensions::InstanceEvalWithArgs,
    [29] FactoryGirl::Syntax::Vintage,
    [30] Nori::CoreExt::Object,
    [31] JSON::Ext::Generator::GeneratorMethods::Object,
    [32] ActiveSupport::Dependencies::Loadable,
    [33] PP::ObjectMixin,
    [34] Kernel
]

On subsequent runs, this list is much smaller:

[
    [ 0] RSpec::Matchers,
    [ 1] RSpec::Core::MockFrameworkAdapter,
    [ 2] RSpec::Core::SharedExampleGroup,
    [ 3] RSpec::Core::Let::ExampleMethods,
    [ 4] RSpec::Core::Let,
    [ 5] RSpec::Core::Pending,
    [ 6] RSpec::Core::Subject::ExampleMethods,
    [ 7] RSpec::Core::Extensions::InstanceEvalWithArgs,
    [ 8] FactoryGirl::Syntax::Vintage,
    [ 9] Nori::CoreExt::Object,
    [10] JSON::Ext::Generator::GeneratorMethods::Object,
    [11] ActiveSupport::Dependencies::Loadable,
    [12] PP::ObjectMixin,
    [13] Kernel,
    [14] RSpec::Mocks::Methods
]

As You can see, Capybara helpers are not included anymore.
Is this a problem that only I have, or do others have this too?
I'll try to reproduce this issue in a small aplication later today.

I'm using JRuby 1.7.0 (also tried 1.6.7.2 - same result), Rails 3.2.8, RSpec 2.12.0, guard-jruby-rspec 0.1.5, capybara 1.1.3

@doxavore
Copy link
Contributor

@mariszin I'm able to reproduce this with all helpers, not just Capybara specs, so I think it's a legitimate issue.

@nilbus
Copy link
Collaborator

nilbus commented May 29, 2013

@mariszin Is this fixed now that #25 was merged?

@mariszin
Copy link
Author

We since moved away from guard-jruby-rspec.
I will recreate the environment and retest to verify once I have some time (maybe weekend).

@m-ramizraja
Copy link

Hi guys,

I'm having same issue. Any one resolved this?

Error:
Repeat tests not passing when using w/ capybara/rspec - #<NoMethodError: undefined method `background' for #Class:0x203d2643>

Thanks

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

4 participants