Sha256: 5120659a356d96d2b9fb537abee5aeea7017b34750d9b5ab812167d6b8afb760
Contents?: true
Size: 665 Bytes
Versions: 11
Compression:
Stored size: 665 Bytes
Contents
require "spec_helper" module Koala::HTTPService RSpec.describe Response do describe "#data" do it "returns nothing if the body is empty" do expect(Response.new(200, "", {}).data).to be_nil end it "parses the JSON if there's a body" do result = {"foo" => "bar"} expect(Response.new(200, result.to_json, {}).data).to eq(result) end it "allows raw values" do expect(Response.new(200, "true", {}).data).to be true end it "raises a ParserError if it's invalid JSON" do expect { Response.new(200, "{", {}).data }.to raise_exception(JSON::ParserError) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems