From d2f3027294658a2d2c1e45c4cd9e5f5a6ff256c3 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 19 Oct 2016 22:39:08 -0500 Subject: [PATCH] Add test for moving notes between posts. --- test/functional/notes_controller_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/functional/notes_controller_test.rb b/test/functional/notes_controller_test.rb index b93e2ac31..354736a01 100644 --- a/test/functional/notes_controller_test.rb +++ b/test/functional/notes_controller_test.rb @@ -47,6 +47,13 @@ class NotesControllerTest < ActionController::TestCase @note.reload assert_equal("xyz", @note.body) end + + should "not allow changing the post id to another post" do + @other = FactoryGirl.create(:post) + post :update, {:format => "json", :id => @note.id, :note => {:post_id => @other.id}}, {:user_id => @user.id} + + assert_not_equal(@other.id, @note.reload.post_id) + end end context "destroy action" do