Skip to content

Commit

Permalink
TW-121 Modified controller to individualize successful creation message
Browse files Browse the repository at this point in the history
  • Loading branch information
BethFrank committed Feb 5, 2015
1 parent b659df8 commit b1e6a30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def create

respond_to do |format|
if @person.save
format.html { redirect_to @person.metamorphosize, notice: 'Person was successfully created.' }
msg = "Person '#{@person.name}' was successfully created."
format.html { redirect_to @person.metamorphosize, notice: msg }
format.json { render action: 'show', status: :created, location: @person }
else
format.html { render action: 'new' }
Expand Down
5 changes: 2 additions & 3 deletions spec/features/people_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@
fill_in('Last name', with: 'Wombat')# and I fill out the last name field with "Wombat"
fill_in('First name', with: 'Hieronymus')# and I fill out the first name field with "Hieronymus"
click_button('Create Person')# when I click the 'Create Person' button
expect(page).to have_content("Person 'Hieronymus Wombat' was successfully created.")
# then I get the message "Person 'Hieronymus Wombat' was successfully created."
# actual message "Person was successfully created."
end
expect(page).to have_content("Person 'Hieronymus Wombat' was successfully created.")
end
end
end

0 comments on commit b1e6a30

Please sign in to comment.