|
@ -13,7 +13,9 @@ describe "New User Registrations" do |
|
|
before do |
|
|
before do |
|
|
visit new_user_registration_path |
|
|
visit new_user_registration_path |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
it 'should have the additional user fields on the registration page' do |
|
|
it 'should have the additional user fields on the registration page' do |
|
|
|
|
|
page.should have_field 'user_username' |
|
|
page.should have_field 'user_first_name' |
|
|
page.should have_field 'user_first_name' |
|
|
page.should have_field 'user_last_name' |
|
|
page.should have_field 'user_last_name' |
|
|
page.should have_field 'user_email' |
|
|
page.should have_field 'user_email' |
|
@ -29,6 +31,13 @@ describe "New User Registrations" do |
|
|
fill_in 'user_password_confirmation', :with => 'password' |
|
|
fill_in 'user_password_confirmation', :with => 'password' |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'should require username' do |
|
|
|
|
|
fill_in 'user_first_name', :with => 'Frank' |
|
|
|
|
|
fill_in 'user_last_name', :with => 'Footer' |
|
|
|
|
|
click_button 'Sign up' |
|
|
|
|
|
page.should have_content "Username can't be blank" |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
it 'should require first name' do |
|
|
it 'should require first name' do |
|
|
fill_in 'user_last_name', :with => 'Footer' |
|
|
fill_in 'user_last_name', :with => 'Footer' |
|
|
click_button 'Sign up' |
|
|
click_button 'Sign up' |
|
@ -41,5 +50,21 @@ describe "New User Registrations" do |
|
|
page.should have_content "Last name can't be blank" |
|
|
page.should have_content "Last name can't be blank" |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'should allow registering many users with empty emails' do |
|
|
|
|
|
expect do |
|
|
|
|
|
FactoryGirl.create :user, email: '' |
|
|
|
|
|
FactoryGirl.create :user, email: nil |
|
|
|
|
|
|
|
|
|
|
|
fill_in 'user_username', :with => 'test3' |
|
|
|
|
|
fill_in 'user_first_name', :with => 'Frank3' |
|
|
|
|
|
fill_in 'user_last_name', :with => 'Footer3' |
|
|
|
|
|
fill_in 'user_password', :with => 'password3' |
|
|
|
|
|
fill_in 'user_password_confirmation', :with => 'password3' |
|
|
|
|
|
click_button 'Sign up' |
|
|
|
|
|
end.to change { User.count }.by(3) |
|
|
|
|
|
|
|
|
|
|
|
expect(User.where(email: nil).count).to eq(3) |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|