Created
April 11, 2012 12:50
-
-
Save austenito/2359120 to your computer and use it in GitHub Desktop.
Integration Testing w/ Sorcery
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
describe "Shopping Cart Requests" do | |
let!(:user) { Fabricate(:user) } | |
before(:each) do | |
login_user_post("admin", "admin") | |
end | |
context "when I visit the shopping cart" do | |
it " show the logged in users' cart items " do | |
#Test stuff | |
end | |
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
RSpec.configure do |config| | |
config.include Sorcery::TestHelpers::Rails | |
end | |
module Sorcery | |
module TestHelpers | |
module Rails | |
def login_user_post(user, password) | |
page.driver.post(user_sessions_url, { username: user, password: password}) | |
end | |
end | |
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
Fabricator(:user, :class_name => "User") do | |
id { sequence } | |
username { "admin" } | |
password { "admin" } | |
display_name { "Admin Boom"} | |
admin { true } | |
email { "[email protected]" } | |
salt { "asdasdastr4325234324sdfds" } | |
crypted_password { Sorcery::CryptoProviders::BCrypt.encrypt("secret", | |
"asdasdastr4325234324sdfds") } | |
end |
This gist doesn't work for me either, I also either get ActionController::RoutingError:
No route matches [POST] "/login"
Or:
NameError:
undefined local variable or method `login_path'
Or:
NameError:
undefined local variable or method `page' for #<RSpec::ExampleGroups:
Did you guys ever figure this out?
I'm getting the undefined local variable or method
page' for ...` issue
@anlek : same error here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kkerley I'm having this exact same problem and I've wasted tons of time on this, does anyone know any hacks or ways around this?