You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following scenario, the change matcher becomes slightly more unwieldy than existing = ...; ...; expect(...).to eq(existing) because it does not include a diff, whereas the eq matcher does:
#!/usr/bin/env rubyrequire"rubygems"require"rspec/autorun"RSpec.describe"foo"dolet(:super_duper_long_string){<<-EOS}Gummi bears bear claw lollipop carrot cake fruitcake I love. Marzipan sesame snaps caramels chocolate bar. Sesame snaps cookie cotton candy tootsie roll. Jujubes wafer jujubes sesame snaps. I love chocolate cake marzipan wafer ice cream fruitcake. Lollipop carrot cake I love donut cake I love. Dragée I love toffee. Brownie topping pastry powder I love soufflé liquorice oat cake. Dessert apple pie oat cake tiramisu croissant chocolate cake. Pie gummies soufflé soufflé cotton candy I love. Caramels ice cream jujubes. Tootsie roll danish tart bear claw.EOSit"changes"doexpectdosuper_duper_long_string.replacesuper_duper_long_string.split(". ").shuffle.join(". ")end.not_tochange{super_duper_long_string}endend
=>
F
Failures:
1) foo changes
Failure/Error:
expect do
super_duper_long_string.replace super_duper_long_string.split(". ").shuffle.join(". ")
end.not_to change { super_duper_long_string }
expected `super_duper_long_string` not to have changed, but did change from "Gummi bears bear claw lollipop carrot cake fruitcake I love. Marzipan sesame snaps caramels chocolat...fflé soufflé cotton candy I love. Caramels ice cream jujubes. Tootsie roll danish tart bear claw.\n" to "Lollipop carrot cake I love donut cake I love. Brownie topping pastry powder I love soufflé liquoric...s bear claw lollipop carrot cake fruitcake I love. Caramels ice cream jujubes. Dragée I love toffee"
# Untitled.rb:12:in `block (2 levels) in <main>'
Finished in 0.05296 seconds (files took 0.10046 seconds to load)
1 example, 1 failure
Failed examples:
rspec Untitled.rb:11 # foo changes
The text was updated successfully, but these errors were encountered:
The change has not defined diffable? to return true in any circumstances, so a diff will never be generated. We could make it diffable, but we'd have to be careful to make sure it doesn't produce confusing diffs since change doesn't have normal expected/actual values.
In the following scenario, the
change
matcher becomes slightly more unwieldy thanexisting = ...; ...; expect(...).to eq(existing)
because it does not include a diff, whereas theeq
matcher does:=>
The text was updated successfully, but these errors were encountered: