]> git.openstreetmap.org Git - rails.git/commitdiff
Fix page title for failed trace updates
authorAnton Khorev <tony29@yandex.ru>
Sat, 31 Aug 2024 16:13:27 +0000 (19:13 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 31 Aug 2024 16:13:27 +0000 (19:13 +0300)
app/controllers/traces_controller.rb
test/controllers/traces_controller_test.rb

index 02b553d0a89814d944ddbeb5e5791f549f809a66..d723bac5b73b634f62d32e99ae6337f8e41c3916 100644 (file)
@@ -143,7 +143,7 @@ class TracesController < ApplicationController
       flash[:notice] = t ".updated"
       redirect_to :action => "show", :display_name => current_user.display_name
     else
-      @title = t ".title", :name => @trace.name
+      @title = t "traces.edit.title", :name => @trace.name
       render :action => "edit"
     end
   rescue ActiveRecord::RecordNotFound
index 972cbb3c32be43e42978e19f27c74c633464ac97..c5f503d6299f5a8814b024b47cca24ed9af00847 100644 (file)
@@ -667,6 +667,17 @@ class TracesControllerTest < ActionDispatch::IntegrationTest
     assert_equal new_details[:visibility], trace.visibility
   end
 
+  # Test invalid updates
+  def test_update_invalid
+    trace = create(:trace)
+
+    # Invalid visibility
+    session_for(trace.user)
+    put trace_path(trace, :trace => { :description => "Changed description", :tagstring => "new_tag", :visibility => "wrong" })
+    assert_response :success
+    assert_select "title", :text => /^Editing Trace/
+  end
+
   # Test destroying a trace
   def test_destroy
     public_trace_file = create(:trace, :visibility => "public")