Created
October 4, 2012 15:18
-
-
Save sam/3834315 to your computer and use it in GitHub Desktop.
new lambda syntax + must_raise
This file contains hidden or 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
it "must raise an exception if the file does not exist" do | |
Helper::tmp do |tmp| | |
assert_raises(Errno::ENOENT) do | |
Doubleshot::Compiler::Classpath.new.add(tmp + "asdf") | |
end | |
end | |
end |
This file contains hidden or 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
it "must raise an exception if the file does not exist" do | |
Helper::tmp do |tmp| | |
lambda do | |
Doubleshot::Compiler::Classpath.new.add(tmp + "asdf") | |
end.must_raise(Errno::ENOENT) | |
end | |
end |
This file contains hidden or 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
it "must raise an exception if the file does not exist" do | |
Helper::tmp do |tmp| | |
-> do | |
Doubleshot::Compiler::Classpath.new.add(tmp + "asdf") | |
end.must_raise(Errno::ENOENT) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been using assertion style because lambda style just seemed awkward to me. But the new lambda syntax is growing on me in this example.
I didn't dislike the new syntax before, I just don't do much assigning lambdas to variables so I haven't had much opportunity to use it. But in this case, it looks nice I think even if it's the same amount of "words" as the old style. I dunno, just some food for thought since the
#must_raise
matcher in Minitest was one of my few gripes with it.