From 66d8ef207ef6c726b6e53c7828cc47058e157a9c Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Mon, 26 May 2014 19:51:08 +0000 Subject: [PATCH] [Misc] Added test for update_attributes, Closes #547 --- lib/acts-as-taggable-on.rb | 2 +- spec/acts_as_taggable_on/taggable_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/acts-as-taggable-on.rb b/lib/acts-as-taggable-on.rb index a3cf986e0..e125d92a6 100644 --- a/lib/acts-as-taggable-on.rb +++ b/lib/acts-as-taggable-on.rb @@ -3,7 +3,7 @@ require 'active_support/core_ext/module' require 'action_view' -require_relative 'acts_as_taggable_on/engine' +require_relative 'acts_as_taggable_on/engine' if defined?(Rails) require 'digest/sha1' diff --git a/spec/acts_as_taggable_on/taggable_spec.rb b/spec/acts_as_taggable_on/taggable_spec.rb index 1bec3ccf0..29af13f28 100644 --- a/spec/acts_as_taggable_on/taggable_spec.rb +++ b/spec/acts_as_taggable_on/taggable_spec.rb @@ -506,6 +506,13 @@ expect(options).to eq({:exclude => true}) end + it 'should not delete tags if not updated' do + model = TaggableModel.create(name: 'foo', tag_list: 'ruby, rails, programming') + model.update_attributes(name: 'bar') + model.reload + expect(model.tag_list).to eq(%w(ruby rails programming)) + end + context 'Duplicates' do context 'should not create duplicate taggings' do let(:bob) { TaggableModel.create(name: 'Bob') }