Last active
December 17, 2015 04:59
-
-
Save pbrisbin/5554629 to your computer and use it in GitHub Desktop.
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
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