Sha256: a74b83fae0a4eb11f08d3f6937f950685b9dd18f81b48b55764ff828f839e52e

Contents?: true

Size: 379 Bytes

Versions: 2

Compression:

Stored size: 379 Bytes

Contents

module ApiTestHelpers
  def response_body
    response.body.strip
  end

  def response_body_json
    ActiveSupport::JSON.decode(response_body)
  end

  def response_body_jsonp(callback)
    jsonp_callback(callback).match(response_body)
  end

  def jsonp_callback(callback)
    /\A#{callback}\((.*),\s+\d{3}\)\z/
  end
end

RSpec.configure do |c|
  c.include ApiTestHelpers
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_api-1.0.1 spec/support/api_test_helpers.rb
acts_as_api-1.0.0 spec/support/api_test_helpers.rb