Module: Shark::RSpec::Helpers::Response

Included in:
Shark::RSpec::Helpers
Defined in:
lib/shark/rspec/helpers/response.rb

Instance Method Summary collapse

Instance Method Details

#fake_response(status, body) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/shark/rspec/helpers/response.rb', line 7

def fake_response(status, body)
  serialized_body = if body.nil? || body.is_a?(String)
                      body
                    else
                      body.to_json
                    end

  {
    headers: {
      content_type: 'application/vnd.api+json'
    },
    status: status,
    body: serialized_body
  }
end