Skip to content

Instantly share code, notes, and snippets.

@stanislaw
Forked from cavalle/warden.rb
Created May 16, 2011 05:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stanislaw/973983 to your computer and use it in GitHub Desktop.
Save stanislaw/973983 to your computer and use it in GitHub Desktop.
Testing Warden/Devise with Steak
# Create a file `spec/acceptance/support/warden.rb' with the following
# contents:
Spec::Runner.configure do |config|
config.include Warden::Test::Helpers, :type => :acceptance
config.after(:each, :type => :acceptance) { Warden.test_reset! }
end
# Or, if you're using RSpec 2 / Rails 3, the contents should be the following
# instead:
RSpec.configure do |config|
config.include Warden::Test::Helpers, :type => :acceptance
config.after(:each, :type => :acceptance) { Warden.test_reset! }
end
# Then in your features you'll only need to call the `login_as` or `logout`
# methods. More info here: http://wiki.github.com/hassox/warden/testing
feature "Home page" do
background do
@user = User.create(...) # Or use fixtures, factories or whatever, even a
# stub user
login_as @user
visit home_page
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment