Skip to content

Commit

Permalink
TW-118 Modified controlled vocabulary controller to individualize suc…
Browse files Browse the repository at this point in the history
…cessful creation message
  • Loading branch information
BethFrank committed Feb 5, 2015
1 parent f451107 commit ead861b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/controlled_vocabulary_terms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ def create
@controlled_vocabulary_term = ControlledVocabularyTerm.new(controlled_vocabulary_term_params)
respond_to do |format|
if @controlled_vocabulary_term.save
msg = "#{@controlled_vocabulary_term.type} '#{@controlled_vocabulary_term.name}' was successfully created."
redirect_url = (request.env['HTTP_REFERER'].include?('controlled_vocabulary_terms/new') ? controlled_vocabulary_term_path(@controlled_vocabulary_term) : :back)
format.html { redirect_to redirect_url, notice: 'Controlled vocabulary term was successfully created.' } # !! new behaviour to test
format.html { redirect_to redirect_url, notice: msg } # !! new behaviour to test
format.json { render action: 'show', status: :created, location: @controlled_vocabulary_term.metamorphosize}
else
format.html {
Expand Down
4 changes: 2 additions & 2 deletions spec/features/controlled_vocabulary_terms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@

click_button('Create Controlled vocabulary term') # I click the 'Create Controlled vocabulary term' button

# then I get the message "Topic 'tests' was successfully created" *
expect(page).to have_content('Controlled vocabulary term was successfully created.')
# then I get the message "Topic 'tests' was successfully created"
expect(page).to have_content("Topic 'tests' was successfully created")
end
end
end

0 comments on commit ead861b

Please sign in to comment.