Sha256: e610a2a2f5bc5c089007469c780fa2b31357529a385eb0785af8d554dfd38f6d

Contents?: true

Size: 361 Bytes

Versions: 2

Compression:

Stored size: 361 Bytes

Contents

RSpec::Matchers.define :be_a_jsonp do |callback_name|
  match do |response_body|
    if callback_name.nil?
      true
    else
      response.body =~ %r[^#{callback_name}\((.*?)\)$]
    end
  end

  description do
    %Q(be a JSONP callback)
  end

  failure_message_for_should do |response_body|
    %Q(should #{description}, but is #{response_body})
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-api-0.2.0 lib/rspec-api/matchers/jsonp.rb
rspec-api-0.1.2 lib/rspec-api/matchers/jsonp.rb