diff options
Diffstat (limited to 'spec/ruby/core/kernel/fail_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/fail_spec.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/spec/ruby/core/kernel/fail_spec.rb b/spec/ruby/core/kernel/fail_spec.rb index 01dffa4a69..ac379b67d5 100644 --- a/spec/ruby/core/kernel/fail_spec.rb +++ b/spec/ruby/core/kernel/fail_spec.rb @@ -1,31 +1,30 @@ require_relative '../../spec_helper' require_relative 'fixtures/classes' -describe "Kernel.fail" do +describe "Kernel#fail" do it "is a private method" do - Kernel.should have_private_instance_method(:fail) + Kernel.private_instance_methods(false).should.include?(:fail) end it "raises a RuntimeError" do - lambda { fail }.should raise_error(RuntimeError) + -> { fail }.should.raise(RuntimeError) end it "accepts an Object with an exception method returning an Exception" do - class Boring - def self.exception(msg) - StandardError.new msg - end + obj = Object.new + def obj.exception(msg) + StandardError.new msg end - lambda { fail Boring, "..." }.should raise_error(StandardError) + -> { fail obj, "..." }.should.raise(StandardError, "...") end it "instantiates the specified exception class" do - class LittleBunnyFooFoo < RuntimeError; end - lambda { fail LittleBunnyFooFoo }.should raise_error(LittleBunnyFooFoo) + error_class = Class.new(RuntimeError) + -> { fail error_class }.should.raise(error_class) end it "uses the specified message" do - lambda { + -> { begin fail "the duck is not irish." rescue => e @@ -34,10 +33,10 @@ describe "Kernel.fail" do else raise Exception end - }.should raise_error(RuntimeError) + }.should.raise(RuntimeError) end end -describe "Kernel#fail" do +describe "Kernel.fail" do it "needs to be reviewed for spec completeness" end |
