summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/creations_controller_spec.rb2
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/devise.rb8
3 files changed, 11 insertions, 1 deletions
diff --git a/spec/controllers/creations_controller_spec.rb b/spec/controllers/creations_controller_spec.rb
index 1489c182..d3b69446 100644
--- a/spec/controllers/creations_controller_spec.rb
+++ b/spec/controllers/creations_controller_spec.rb
@@ -5,7 +5,7 @@ describe CreationsController do
let(:creation){ FactoryGirl.create(:creation, :user => user) }
before (:each) do
- request.env['warden'] = mock(Warden, :authenticate => user, :authenticate! => user)
+ http_login(user)
end
describe "GET index" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5820bccb..a2696ee2 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,12 +6,14 @@ Spork.prefork do
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
+ config.include DeviseHelper
end
end
diff --git a/spec/support/devise.rb b/spec/support/devise.rb
new file mode 100644
index 00000000..3ba82027
--- /dev/null
+++ b/spec/support/devise.rb
@@ -0,0 +1,8 @@
+module DeviseHelper
+ def http_login(user)
+ gateway = fake
+ gateway.stub(:authenticate).and_return(user)
+ gateway.stub(:authenticate!).and_return(user)
+ request.env['warden'] = gateway
+ end
+end