Adjust evaluation order of change matcher expressions

Handles reference types better and matches RSpec more closely.
This commit is contained in:
Michael Miller 2022-05-14 23:30:15 -06:00
parent 739629ef9d
commit 0704fd2a48
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2
5 changed files with 73 additions and 66 deletions

View file

@ -34,16 +34,14 @@ Spectator.describe "Explicit Subject" do
subject { @@element_list.pop }
skip "is memoized across calls (i.e. the block is invoked once)",
reason: "RSpec calls the \"actual\" block after the \"change block\"." do
it "is memoized across calls (i.e. the block is invoked once)" do
expect do
3.times { subject }
end.to change { @@element_list }.from([1, 2, 3]).to([1, 2])
expect(subject).to eq(3)
end
skip "is not memoized across examples",
reason: "RSpec calls the \"actual\" block after the \"change block\"." do
it "is not memoized across examples" do
expect { subject }.to change { @@element_list }.from([1, 2]).to([1])
expect(subject).to eq(2)
end