I have an RSpec test currently written on an application that 100% works, it current returns exactly what I want.
The application call method returns a Json list and the test I have is then supposed to check if certain elements are equal to an equivalent Json passed in. Simple right?
describe App do
subject(:jsonlist) do
final_json = App.call(json)
JSON.load(final_json)
end
it "checks the json" do
expect(jsonlist[2]["num"].to eq "10.00")
end
It works fine for one test. But after that, Rspec calls the application again and again, adding the data on top of the existing json elements (10 becomes 20, 30, 160 whatever).
Anyone got any ideas why this is happening and how I can get Rspec to stop calling the application when I only need it to call the returned data once?
Many thanks in advance. My apologies for any confusion, I'm still new here
question from:
https://stackoverflow.com/questions/66056012/why-does-rspec-increment-return-of-called-application 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…