+ def test_update
+ user = create(:user)
+ other_user = create(:user)
+ diary_entry = create(:diary_entry, :language_code => "en", :user => user, :title => "Original Title")
+
+ put diary_entry_path(user, diary_entry, :diary_entry => { :title => "Updated Title" })
+ assert_response :forbidden
+ diary_entry.reload
+ assert_equal "Original Title", diary_entry.title
+
+ session_for(other_user)
+ put diary_entry_path(user, diary_entry, :diary_entry => { :title => "Updated Title" })
+ assert_redirected_to diary_entry_path(user, diary_entry)
+ diary_entry.reload
+ assert_equal "Original Title", diary_entry.title
+
+ session_for(user)
+ put diary_entry_path(user, diary_entry, :diary_entry => { :title => "Updated Title" })
+ assert_redirected_to diary_entry_path(user, diary_entry)
+ diary_entry.reload
+ assert_equal "Updated Title", diary_entry.title
+ end
+