Sha256: 2995c9b82d2167af913191ffb3166cadd01b860277ba1a806de14240aa793bf2
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module Spec module Matchers class BeInstanceOf def initialize(expected) @expected = expected end def matches?(actual) @actual = actual @actual.instance_of?(@expected) end def description "be an instance of #{@expected}" end def failure_message "expected instance of #{@expected}, got #{@actual.inspect}" end def negative_failure_message "expected #{@actual.inspect} not to be an instance of #{@expected}" end end # :call-seq: # should be_instance_of(expected) # should be_an_instance_of(expected) # should_not be_instance_of(expected) # should_not be_an_instance_of(expected) # # Passes if actual.instance_of?(expected) # # == Examples # # 5.should be_instance_of(Fixnum) # 5.should_not be_instance_of(Numeric) # 5.should_not be_instance_of(Float) def be_instance_of(expected) BeInstanceOf.new(expected) end alias_method :be_an_instance_of, :be_instance_of end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dchelimsky-rspec-1.1.99.7 | lib/spec/matchers/be_instance_of.rb |
dchelimsky-rspec-1.1.99.8 | lib/spec/matchers/be_instance_of.rb |
dchelimsky-rspec-1.1.99.9 | lib/spec/matchers/be_instance_of.rb |