Last active
December 21, 2015 08:09
-
-
Save shuhei/6276438 to your computer and use it in GitHub Desktop.
RSpec's should style to expect style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj.should ... | |
expect(obj).to ... | |
obj.should_not ... | |
expect(obj).not_to ... | |
obj.should =~ // | |
expect(obj).to match(//) | |
[1, 2, 3].should =~ [3, 2, 1] | |
expect([1, 2, 3]).to match_array([3, 2, 1]) | |
obj.should > 3 | |
expect(obj).to be > 3 | |
lambda { ... }.should raise_error | |
expect { ... }.to raise_error | |
# RSpec 2.14.0 or later | |
obj.stub(:foo) | |
allow(obj).to receive(:foo) | |
SomeClass.any_instance.should_receive(:foo) | |
expect_any_instance_of(SomeClass).to receive(:foo) | |
SomeClass.any_instance.stub(:foo) | |
allow_any_instance_of(SomeClass).to receive(:foo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment