Files
grecia/spec/lib/tasks/migrations_spec.rb
Javi Martín b8fbd6347b 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.
2019-11-01 17:12:31 +01:00

23 lines
779 B
Ruby

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