Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Capybara.reset_sessions! in after block like rspec #7

Closed
allaire opened this Issue · 4 comments

3 participants

@allaire

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

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
@jamesotron

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

@blowmage
Owner
@jamesotron

just figured that out. thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.