Use acts_as_taggable for investment valuation tags
We were manually doing the same thing, generating inconsistent results, since the method `valuation_tag_list` was using the `valuation` context, when actually the expected behavior would be to use the `valuation_tag` context.
This commit is contained in:
22
spec/lib/tasks/migrations_spec.rb
Normal file
22
spec/lib/tasks/migrations_spec.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Migration tasks" do
|
||||
let(:run_rake_task) do
|
||||
Rake::Task["migrations:valuation_taggings"].reenable
|
||||
Rake.application.invoke_task("migrations:valuation_taggings")
|
||||
end
|
||||
|
||||
it "updates taggings" do
|
||||
valuation_tagging = create(:tagging, context: "valuation")
|
||||
another_valuation_tagging = create(:tagging, context: "valuation")
|
||||
valuation_tags_tagging = create(:tagging, context: "valuation_tags")
|
||||
tags_tagging = create(:tagging)
|
||||
|
||||
run_rake_task
|
||||
|
||||
expect(valuation_tagging.reload.context).to eq "valuation_tags"
|
||||
expect(another_valuation_tagging.reload.context).to eq "valuation_tags"
|
||||
expect(valuation_tags_tagging.reload.context).to eq "valuation_tags"
|
||||
expect(tags_tagging.reload.context).to eq "tags"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user