spec/rspec/mocks/matchers/receive_spec.rb in rspec-mocks-2.14.0.rc1 vs spec/rspec/mocks/matchers/receive_spec.rb in rspec-mocks-2.14.0
- old
+ new
@@ -134,9 +134,19 @@
expect {
receiver.foo(:a)
}.to raise_error(/expected: 0 times.*received: 1 time/m)
end
+
+ it 'prevents confusing double-negative expressions involving `never`' do
+ expect {
+ wrapped.not_to receive(:foo).never
+ }.to raise_error(/trying to negate it again/)
+
+ expect {
+ wrapped.to_not receive(:foo).never
+ }.to raise_error(/trying to negate it again/)
+ end
end
describe "allow(...).to receive" do
include_examples "an expect syntax allowance" do
let(:receiver) { double }