Skip to content

Commit

Permalink
[Misc] Added test for update_attributes, Closes #547
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed May 26, 2014
1 parent 09828c0 commit 88ec6a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts-as-taggable-on.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
7 changes: 7 additions & 0 deletions spec/acts_as_taggable_on/taggable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.sort).to eq(%w(ruby rails programming).sort)
end

context 'Duplicates' do
context 'should not create duplicate taggings' do
let(:bob) { TaggableModel.create(name: 'Bob') }
Expand Down

0 comments on commit 88ec6a5

Please sign in to comment.