Class: Is::RSpec::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/is/rspec.rb

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Matcher

Returns a new instance of Matcher.



6
7
8
# File 'lib/is/rspec.rb', line 6

def initialize type
  @type = type
end

Instance Method Details

#descriptionObject



19
20
21
# File 'lib/is/rspec.rb', line 19

def description
  "be of #{@type}"
end

#failure_messageObject



15
16
17
# File 'lib/is/rspec.rb', line 15

def failure_message
  @instance.to_s
end

#matches?(it) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/is/rspec.rb', line 10

def matches? it
  @instance = @type.new it
  @instance.ok?
end