Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagged with rewrite #829

Merged
merged 10 commits into from
May 16, 2017
Merged
1 change: 0 additions & 1 deletion lib/acts-as-taggable-on.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'active_record/version'
require 'active_support/core_ext/module'


begin
require 'rails/engine'
require 'acts_as_taggable_on/engine'
Expand Down
2 changes: 1 addition & 1 deletion spec/acts_as_taggable_on/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
context 'retry 3 times on not unique exception' do
it 'performs 3 tries before raising the exception' do
allow(ActsAsTaggableOn::Tag).to receive(:named_any).and_raise(ActiveRecord::RecordNotUnique.new('error')) # trigger error inside block
expect(ActiveRecord::Base.connection).to receive(:execute).with('ROLLBACK').exactly(3).times
expect(ActiveRecord::Base.connection).to receive(:execute).with('ROLLBACK').exactly(4).times # one extra rollback from database cleaner
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let change the Datacleaner strategy to :deletion and correct the test
https://github.com/mbleigh/acts-as-taggable-on/blob/master/spec/support/database_cleaner.rb#L5


expect {
ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name('AWESOME', 'awesome')
Expand Down
2 changes: 0 additions & 2 deletions spec/acts_as_taggable_on/taggable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@
@taggable.save

expect(TaggableModel.tagged_with('ruby').first).to eq(@taggable)

expect(TaggableModel.tagged_with('ruby, css').first).to eq(@taggable)
expect(TaggableModel.tagged_with('bob', on: :skills).first).to_not eq(@taggable)
expect(TaggableModel.tagged_with('bob', on: :tags).first).to eq(@taggable)
Expand Down Expand Up @@ -459,7 +458,6 @@
frank = TaggableModel.create(name: 'Frank', tag_list: 'weaker, depressed, inefficient', skill_list: 'ruby, rails, css')
steve = TaggableModel.create(name: 'Steve', tag_list: 'fitter, happier, more productive', skill_list: 'c++, java, ruby')


expect(TaggableModel.tagged_with(%w(ruby java), any: true, order_by_matching_tag_count: true, order: 'taggable_models.name').to_a).to eq([steve, bob, frank])
expect(TaggableModel.tagged_with(%w(c++ fitter), any: true, order_by_matching_tag_count: true, order: 'taggable_models.name').to_a).to eq([steve, bob])
expect(TaggableModel.tagged_with(%w(depressed css), any: true, order_by_matching_tag_count: true, order: 'taggable_models.name').to_a).to eq([frank, bob])
Expand Down