From 8b4672616649a57375d449b3b5159f57cc5c40f0 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 21 Oct 2016 04:41:05 -0500 Subject: [PATCH] Fix tests for `before_validation :normalize_tags`. `update_attribute` doesn't trigger `before_validation` callbacks, which is where metatag processing happens. `update` or `update_attributes` must be used instead. AFAIK the test suite is the only place where `post.update_attribute(:tag_string => "stuff")` is used, the actual code doesn't use it. --- test/unit/post_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index f3e038bdc..685bf442d 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -460,7 +460,7 @@ class PostTest < ActiveSupport::TestCase context "as a new user" do setup do - @post.update_attribute(:tag_string, "aaa bbb ccc ddd tagme") + @post.update(:tag_string => "aaa bbb ccc ddd tagme") CurrentUser.user = FactoryGirl.create(:user) end @@ -493,9 +493,9 @@ class PostTest < ActiveSupport::TestCase CurrentUser.user = FactoryGirl.create(:builder_user) Delayed::Worker.delay_jobs = false @post = Post.find(@post.id) - @post.update_attribute(:tag_string, "art:abc") + @post.update(:tag_string => "art:abc") @post = Post.find(@post.id) - @post.update_attribute(:tag_string, "copy:abc") + @post.update(:tag_string => "copy:abc") @post.reload end @@ -522,7 +522,7 @@ class PostTest < ActiveSupport::TestCase setup do FactoryGirl.create(:tag_alias, :antecedent_name => "abc", :consequent_name => "xyz") @post = Post.find(@post.id) - @post.update_attribute(:tag_string, "art:abc") + @post.update(:tag_string => "art:abc") @post.reload end