module Spryte::RSpec::Helpers

Public Instance Methods

errors() click to toggle source
# File lib/spryte/rspec/helpers.rb, line 12
def errors
  json.fetch(:errors) { [] }
end
json() click to toggle source
# File lib/spryte/rspec/helpers.rb, line 5
def json
  expect(response.body).to_not be_empty, lambda { "Expected there to be a JSON root, but the response body is empty." }
  @json ||= JSON.parse(response.body).with_indifferent_access
rescue JSON::ParserError
  raise "Invalid JSON response:\n\n#{response.body}"
end