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.



231
232
233
# File 'lib/assert2/rjs.rb', line 231

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.



243
244
245
# File 'lib/assert2/rjs.rb', line 243

def failure_message
  @failure_message
end

#negative_failure_messageObject (readonly)

Returns the value of attribute negative_failure_message.



243
244
245
# File 'lib/assert2/rjs.rb', line 243

def negative_failure_message
  @negative_failure_message
end

Instance Method Details

#matches?(response, &block) ⇒ Boolean

Returns:

  • (Boolean)


235
236
237
238
239
240
241
# File 'lib/assert2/rjs.rb', line 235

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