Created
August 8, 2012 15:53
-
-
Save mbhnyc/3296161 to your computer and use it in GitHub Desktop.
Why are my integration tests running twice?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest_helper' | |
describe "Home integration" do | |
it "has content" do | |
visit root_path | |
assert page.has_content?("Be the first to know") | |
end | |
it "is possible to log in and log out" do | |
provider = create(:provider) | |
visit new_provider_session_path | |
fill_in('Email', :with => provider.email) | |
fill_in('Password', :with => 'secret') | |
click_button('Sign in') | |
assert page.has_content?("Dashboard") | |
click_link('Sign out') | |
assert page.has_content?("Signed out successfully.") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] = "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require "minitest/autorun" | |
require "minitest/rails" | |
require "factory_girl" | |
require "minitest/rails/capybara" | |
require "minitest/pride" | |
require 'turn' | |
require "active_support/testing/setup_and_teardown" | |
class MiniTest::Rails::ActiveSupport::TestCase | |
include FactoryGirl::Syntax::Methods | |
# Add more helper methods to be used by all tests here... | |
end | |
MiniTest::Rails.override_testunit! | |
DatabaseCleaner.strategy = :truncation | |
# Turn.config.format = :outline | |
class IntegrationTest < MiniTest::Rails::ActiveSupport::TestCase | |
include Capybara::DSL | |
include Rails.application.routes.url_helpers | |
after do | |
DatabaseCleaner.clean # Truncate the database | |
Capybara.reset_sessions! # Forget the (simulated) browser state | |
Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver | |
end | |
register_spec_type(/integration$/, self) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment