1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-09-29 19:13:35 +02:00
parent 2d41c712a7
commit d51b4e34fb
7 changed files with 16 additions and 3 deletions

View file

@ -7,6 +7,9 @@ class SpecExpectationNotFoundError < StandardError
end
end
class SkippedSpecError < StandardError
end
class SpecExpectation
def self.fail_with(expected, actual)
expected_to_s = expected.to_s

View file

@ -1,3 +1,5 @@
require 'mspec/guards/version'
def suppress_warning
verbose = $VERBOSE
$VERBOSE = nil

View file

@ -34,3 +34,4 @@ require 'mspec/matchers/output_to_fd'
require 'mspec/matchers/respond_to'
require 'mspec/matchers/signed_zero'
require 'mspec/matchers/block_caller'
require 'mspec/matchers/skip'

View file

@ -0,0 +1,5 @@
module MSpecMatchers
private def skip(reason = 'no reason')
raise SkippedSpecError, reason
end
end

View file

@ -214,7 +214,7 @@ class ContextState
if example
passed = protect nil, example
MSpec.actions :example, state, example
protect nil, @expectation_missing unless MSpec.expectation? or !passed
protect nil, @expectation_missing if !MSpec.expectation? and passed
end
end
protect "after :each", post(:each)

View file

@ -105,6 +105,8 @@ module MSpec
return true
rescue SystemExit => e
raise e
rescue SkippedSpecError => e
return false
rescue Exception => exc
register_exit 1
actions :exception, ExceptionState.new(current && current.state, location, exc)

View file

@ -99,9 +99,9 @@ describe Object, "#new_io" do
rm_r @name
end
it "returns an IO instance" do
it "returns a File instance" do
@io = new_io @name
@io.should be_an_instance_of(IO)
@io.should be_an_instance_of(File)
end
it "opens the IO for reading if passed 'r'" do