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.
23 lines
779 B
Ruby
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
|