Skip to content

Commit

Permalink
revise signup form,specs per User validations
Browse files Browse the repository at this point in the history
  • Loading branch information
christinalcole committed Aug 25, 2017
1 parent c6603cc commit b89375c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
20 changes: 20 additions & 0 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<div class="field">
<%= f.label :first_name %><br />
<%= f.text_field :first_name, autofocus: true %>
</div>

<div class="field">
<%= f.label :last_name %><br />
<%= f.text_field :last_name, autofocus: true %>
</div>

<div class="field">
<%= f.label :phone_number %><br />
<%= f.text_field :phone_number, autofocus: true %>
</div>

<div class="field">
<%= f.label :weight %><em>(in lbs)</em><br />
<%= f.text_field :weight, autofocus: true %>
</div>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/signin_and_signup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
scenario 'a user cannot sign up if already registerd'
scenario 'a user can sign up with valid credentials' do
user = FactoryGirl.build(:user)
signup(user.email, user.password)
signup(user.first_name, user.last_name, user.phone_number, user.weight, 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'
Expand Down
6 changes: 5 additions & 1 deletion spec/support/helpers/session_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ def signin(email, password)
click_button 'Log in'
end

def signup(email, password)
def signup(first_name, last_name, phone_number, weight, email, password)
visit new_user_registration_path
fill_in 'First name', with: first_name
fill_in 'Last name', with: last_name
fill_in 'Phone number', with: phone_number
fill_in 'Weight', with: weight
fill_in 'Email', with: email
fill_in 'Password', with: password
fill_in 'Password confirmation', with: password
Expand Down

0 comments on commit b89375c

Please sign in to comment.