Capybara.reset_sessions! in after block like rspec #7

Closed
allaire opened this Issue Apr 2, 2013 · 4 comments

Comments

Projects
None yet
3 participants

allaire commented Apr 2, 2013

https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec.rb#L14

Rspec reset session after each test run to reduce test dependance I think, here's a discussion about it: jnicklas/capybara#419

If our goals is to stay similar to capybara/rspec, we should add it too!

allaire commented Apr 2, 2013

For reference, here is my current Capybara::Rails::TestCase class in my test_helper.rb

class Capybara::Rails::TestCase
  self.use_transactional_fixtures = false

  before do
    if metadata[:js]
      Capybara.current_driver = Capybara.javascript_driver
      DatabaseCleaner.strategy = :truncation
      DatabaseCleaner.start
    end
  end

  after do
    if metadata[:js]
      DatabaseCleaner.clean
    end

    Capybara.reset_sessions!
    Capybara.current_driver = Capybara.default_driver
  end

  # Custom method helpers
  def sign_in
    # ...
  end
end

@blowmage blowmage closed this in 1480447 Jul 24, 2013

Shouldn't this be after(:each) not after(:all) ?

Owner

blowmage commented Feb 3, 2014

Minitest's Spec DSL doesn't have after(:each) or after(:all), just after().

just figured that out. thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment