Skip to content

Commit

Permalink
a registered organization can log in and view its profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Erin Joan Snyder authored and Erin Joan Snyder committed Jul 23, 2014
1 parent 341d333 commit d1cd92a
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion spec/features/user_login_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

feature 'Registered user' do
feature 'Registered donor' do
scenario 'should be able to see the login button when logged out' do
visit root_path
expect(page).to have_content('Log In')
Expand Down Expand Up @@ -35,6 +35,48 @@
expect(page).to have_content('Request History')
end

def log_in_with(email, password)
visit user_type_login_confirmation_sessions_path
fill_in 'Email', with: email
fill_in 'Password', with: password
click_on 'Log In'
end
end

feature 'Registered organization' do
scenario 'should be able to see the login button when logged out' do
visit root_path
expect(page).to have_content('Log In')
end

scenario 'should be able to log in with valid params' do
FactoryGirl.create(:organization)
log_in_with 'name@sample.org', 'password'
expect(page).to have_content("successful login!!")
end

scenario 'should not be able to log in with invalid params' do
FactoryGirl.create(:organization)
log_in_with 'invalid_email', 'password'
expect(page).to have_content('Unsuccessful login')
end

scenario 'should not be able to log in with blank password' do
FactoryGirl.create(:organization)
log_in_with 'name@sample.org', ''
expect(page).to have_content('Unsuccessful login')
end

scenario 'should be able to view their profile after logging in' do
FactoryGirl.create(:organization)
log_in_with 'name@sample.org', 'password'
expect(page).to have_content("successful login!!")
click_on 'PROFILE'
expect(page).to have_content('Make New Request')
expect(page).to have_content('Active Requests')
expect(page).to have_content('Request History')
end

def log_in_with(email, password)
visit user_type_login_confirmation_sessions_path
fill_in 'Email', with: email
Expand Down

0 comments on commit d1cd92a

Please sign in to comment.