Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move common request spec code into spec_helper.rb

  • Loading branch information...
commit 492cdd61e1f86a33f12ba8e388292f72f1d3ac82 1 parent ca9f4e7
@malclocke malclocke authored
View
3  spec/requests/confirmations_spec.rb
@@ -2,10 +2,7 @@
describe "Confirmations" do
- self.use_transactional_fixtures = false
-
before(:each) do
- DatabaseCleaner.clean
ActionMailer::Base.deliveries = []
end
View
4 spec/requests/localization_spec.rb
@@ -1,12 +1,8 @@
require 'spec_helper'
describe "localization" do
- include IntegrationHelpers
-
- self.use_transactional_fixtures = false
before(:each) do
- DatabaseCleaner.clean
sign_in user
end
View
8 spec/requests/logins_spec.rb
@@ -2,14 +2,6 @@
describe "Logins" do
- include IntegrationHelpers
-
- self.use_transactional_fixtures = false
-
- before(:each) do
- DatabaseCleaner.clean
- end
-
let(:user) {
FactoryGirl.create :user, :email => 'user@example.com',
:password => 'password'
View
5 spec/requests/notes_spec.rb
@@ -2,12 +2,7 @@
describe "Notes" do
- include IntegrationHelpers
-
- self.use_transactional_fixtures = false
-
before(:each) do
- DatabaseCleaner.clean
# FIXME - Having to set this really high for the 'adds a note to a story
# spec'. Need to work on making it more responsive.
Capybara.default_wait_time = 10
View
5 spec/requests/projects_spec.rb
@@ -2,12 +2,7 @@
describe "Projects" do
- include IntegrationHelpers
-
- self.use_transactional_fixtures = false
-
before(:each) do
- DatabaseCleaner.clean
sign_in user
end
View
5 spec/requests/stories_spec.rb
@@ -2,12 +2,7 @@
describe "Stories" do
- include IntegrationHelpers
-
- self.use_transactional_fixtures = false
-
before(:each) do
- DatabaseCleaner.clean
sign_in user
end
View
15 spec/spec_helper.rb
@@ -30,10 +30,23 @@
DatabaseCleaner.strategy = :truncation
end
+ config.before(:type => :request) do
+ DatabaseCleaner.clean
+ end
+
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
- config.include Devise::TestHelpers, :type => :controller
+ config.include Devise::TestHelpers, :type => :controller
+ config.include IntegrationHelpers, :type => :request
+
+ # Turn this off in all request specs
+ module DisableTransactionalFixtures
+ def self.included(base)
+ base.use_transactional_fixtures = false
+ end
+ end
+ config.include DisableTransactionalFixtures, :type => :request
end
Please sign in to comment.
Something went wrong with that request. Please try again.