Sha256: 3235b20bf84620778f7f04b19104443548c8c9b51eb04789839cf0c298cbf8db

Contents?: true

Size: 540 Bytes

Versions: 180

Compression:

Stored size: 540 Bytes

Contents

class BeAnInstanceOfMatcher
  def initialize(expected)
    @expected = expected
  end

  def matches?(actual)
    @actual = actual
    @actual.instance_of?(@expected)
  end

  def failure_message
    ["Expected #{@actual.inspect} (#{@actual.class})",
     "to be an instance of #{@expected}"]
  end

  def negative_failure_message
    ["Expected #{@actual.inspect} (#{@actual.class})",
     "not to be an instance of #{@expected}"]
  end
end

class Object
  def be_an_instance_of(expected)
    BeAnInstanceOfMatcher.new(expected)
  end
end

Version data entries

180 entries across 156 versions & 4 rubygems

Version Path
rhodes-7.6.0 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-7.5.1 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-7.4.1 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-7.1.17 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-6.2.0 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-6.0.11 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.18 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
mspec-1.9.1 lib/mspec/matchers/be_an_instance_of.rb
mspec-1.9.0 lib/mspec/matchers/be_an_instance_of.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/matchers/be_an_instance_of.rb
mspec-1.8.0 lib/mspec/matchers/be_an_instance_of.rb