class RSpecApi::Matchers::Jsonp::Matcher

Attributes

callback[RW]

Public Class Methods

new(callback) click to toggle source
# File lib/rspec-api/matchers/jsonp/matcher.rb, line 9
def initialize(callback)
  @callback = callback
end

Public Instance Methods

description() click to toggle source
# File lib/rspec-api/matchers/jsonp/matcher.rb, line 17
def description
  %Q(be wrapped in a JSONP callback #{callback}).rstrip
end
matches?(response) click to toggle source
# File lib/rspec-api/matchers/jsonp/matcher.rb, line 13
def matches?(response)
  super && body =~ %r{^#{callback || '.+?'}\((.*?)\)$}
end