Sha256: 7efd6f5de2e662f28ac225a2b4869cd0d52cabab295d1f9a88d6d5616b7a993b
Contents?: true
Size: 839 Bytes
Versions: 7
Compression:
Stored size: 839 Bytes
Contents
require 'spec_helper' require 'howitzer/mailgun_api/client' require 'howitzer/exceptions' RSpec.describe Howitzer::MailgunApi::Response do let(:body) { { foo: 'bar' }.to_json } let(:response) { double(:response, body: body, code: 201) } describe '#body' do subject { described_class.new(response).body } it { is_expected.to eq('{"foo":"bar"}') } end describe '#code' do subject { described_class.new(response).code } it { is_expected.to eq(201) } end describe '#to_h' do subject { described_class.new(response).to_h } context 'when possible parse body' do it { is_expected.to eq('foo' => 'bar') } end context 'when impossible parse body' do let(:body) { "'123': '123' :123" } it do expect { subject }.to raise_error(Howitzer::ParseError) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems