-
-
Save stanislaw/973983 to your computer and use it in GitHub Desktop.
Testing Warden/Devise with Steak
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
# 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 |
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
# 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