Last active
December 23, 2015 03:19
-
-
Save kachick/6572946 to your computer and use it in GitHub Desktop.
MSpec 2.0 - I'm digging https://github.com/rubyspec/mspec/blob/80b78a81929a32c38410126561f5b9b8fc85a848/README.md
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
behavior :array_uniq_on_dupulicated_elements, :shared => true do | |
it "returns a squashed array" do | |
verify([1, 1].send(@method)).is.eq([1]) | |
end | |
end | |
describe "Array#uniq" do | |
context "when elements are duplicated" do | |
verify.behavior(:array_uniq_on_dupulicated_elements, :uniq) | |
before(:each) do | |
@array = [1, 1] | |
end | |
it "returns a new array" do | |
ret = @array.uniq | |
verify(ret).isnt(@array) | |
verify(ret).is.instance_of(Array) | |
end | |
end | |
end | |
describe "Array#uniq!" do | |
context "when elements are duplicated" do | |
verify.behavior(:array_uniq_on_dupulicated_elements, :uniq!) | |
before(:each) do | |
@array = [1, 1] | |
end | |
it "returns self" do | |
verify(@array.uniq!).is(@array) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment