Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Last active December 17, 2015 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbrisbin/5554629 to your computer and use it in GitHub Desktop.
Save pbrisbin/5554629 to your computer and use it in GitHub Desktop.
require "spec_helper"
describe "Proprietors sign in", focus: true do
it "allows proprietors to sign in after they have registered" do
user = create_user
visit proprietor_login_path
fill_in "Email", :with => user.email
fill_in "Password", :with => "secret"
click_button "Sign In"
current_path.should eq(dashboard_path)
page.should have_content("Signed in successfully.")
end
it "does not allow proprietors to sign with incorrect credentials" do
user = create_user
visit proprietor_login_path
fill_in "Email", :with => user.email
fill_in "Password", :with => "invalid"
click_button "Sign In"
current_path.should eq(proprietor_sessions_path)
page.should have_content("Invalid email or password")
end
def create_user
role = create(:role_proprietor)
user = create(:proprietor, :password => 'secret', :password_confirmation => 'secret')
user.roles << role
user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment