Skip to content

Instantly share code, notes, and snippets.

@ChuntaoLu
Forked from austenito/integration_spec.rb
Created January 28, 2014 07:43
Show Gist options
  • Save ChuntaoLu/8663649 to your computer and use it in GitHub Desktop.
Save ChuntaoLu/8663649 to your computer and use it in GitHub Desktop.
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
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
Fabricator(:user, :class_name => "User") do
id { sequence }
username { "admin" }
password { "admin" }
display_name { "Admin Boom"}
admin { true }
email { "whatever@whatever.com" }
salt { "asdasdastr4325234324sdfds" }
crypted_password { Sorcery::CryptoProviders::BCrypt.encrypt("secret",
"asdasdastr4325234324sdfds") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment