Class: Spec::Matchers::SendJsTo

Inherits:
Object
  • Object
show all
Defined in:
lib/assert2/rjs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, command, *args, &block) ⇒ SendJsTo

Returns a new instance of SendJsTo.



170
171
172
# File 'lib/assert2/rjs.rb', line 170

def initialize(scope, command, *args, &block)
  @scope, @command, @args, @block = scope, command, args, block
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



181
182
183
# File 'lib/assert2/rjs.rb', line 181

def failure_message
  @failure_message
end

#negative_failure_messageObject (readonly)

Returns the value of attribute negative_failure_message.



181
182
183
# File 'lib/assert2/rjs.rb', line 181

def negative_failure_message
  @negative_failure_message
end

Instance Method Details

#matches?(response, &block) ⇒ Boolean

Returns:

  • (Boolean)


174
175
176
177
178
179
# File 'lib/assert2/rjs.rb', line 174

def matches?(response, &block)
  @block = block if block
  sample, asserter = @scope.__interpret_rjs(response, @command, @args, &@block)
  return !(@failure_message = asserter.failure_message) # or
#         @negative_failure_message = "should not find #{sample.inspect} in\n#{asserter.js}" #  TODO  complaint system
end