Skip to content

Prevent should from circumventing target check

gitlab-qa-bot requested to merge streamline-should-oneliners into main

Created by: pirj

By directly instantiating expectation handler, should/should_not was circumventing enforce_value_expectation check.

subject(:action) { -> { raise } }
it { should raise_error StandardError }

would not print "The implicit block expectation syntax is deprecated", while

subject(:action) { -> { raise } }
it { is_expected.to raise_error StandardError }

will.

See https://github.com/rspec/rspec-expectations/pull/1139

Merge request reports