Class: BeOneAnd

Inherits:
Object
  • Object
show all
Defined in:
lib/itesttool/custom_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(matcher) ⇒ BeOneAnd

Returns a new instance of BeOneAnd.



118
119
120
# File 'lib/itesttool/custom_matchers.rb', line 118

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

#failure_message_for_shouldObject



132
133
134
135
136
137
138
# File 'lib/itesttool/custom_matchers.rb', line 132

def failure_message_for_should
  if @have_error 
    @have.failure_message_for_should
  else
    @matcher.failure_message_for_should
  end
end

#matches?(rows) ⇒ Boolean

Returns:

  • (Boolean)


122
123
124
125
126
127
128
129
130
# File 'lib/itesttool/custom_matchers.rb', line 122

def matches?(rows)
  @have_error = false
  @have = RSpec::Matchers::BuiltIn::Have.new(1).items
  unless @have.matches? rows then
    @have_error = true
    return false;
  end
  @matcher.matches? rows[0]
end