diff --git a/spec/features/users/signin_and_signup_spec.rb b/spec/features/users/signin_and_signup_spec.rb index bc89dd5..f58c576 100644 --- a/spec/features/users/signin_and_signup_spec.rb +++ b/spec/features/users/signin_and_signup_spec.rb @@ -27,7 +27,11 @@ RSpec.feature 'Sign up', :devise do scenario 'a user cannot sign up if already registerd' - scenario 'a user can sign up with valid credentials' + scenario 'a user can sign up with valid credentials' do + user = FactoryGirl.build(:user) + signup(user.email, user.password) + expect(page).to have_content I18n.t 'devise.registrations.signed_up' + end scenario 'a user cannot sign up without an email' scenario 'a user cannot sign up without a unique email' scenario 'a user cannot sign up without a valid password' diff --git a/spec/support/helpers/session_helpers.rb b/spec/support/helpers/session_helpers.rb index 1354c23..a0405e2 100644 --- a/spec/support/helpers/session_helpers.rb +++ b/spec/support/helpers/session_helpers.rb @@ -6,5 +6,13 @@ def signin(email, password) fill_in 'Password', with: password click_button 'Log in' end + + def signup(email, password) + visit new_user_registration_path + fill_in 'Email', with: email + fill_in 'Password', with: password + fill_in 'Password confirmation', with: password + click_button 'Sign up' + end end end