I'm in the process of upgrading a legacy project to rails 5.0 and some tests are failing. I have the following test:
describe ItemRun do
describe "#item_template" do
context "with an item template that has been deleted" do
let(:item_template) { ItemTemplate.create! title: "Hello" }
let!(:item_run) { item_template.item_runs.create! title: "Testing" }
before do
item_template.update_attributes(deleted: true)
end
it "responds to :title" do
expect(item_run.item_template.title).to eq ""
end
end
end
end
The error reports the following:
ItemRun#item_template with a item template that has been deleted responds to :title
Failure/Error: expect(item_run.item_template.title).to eq ""
expected: ""
got: "Hello"
(compared using ==)
# ./spec/models/item_run_spec.rb:14:in `block (4 levels) in <top (required)>'
I also tried item_template.destroy
but got the same result. Any ideas?
Aucun commentaire:
Enregistrer un commentaire