Sha256: ded9fc415b0d955afb1f436bbad72069073dae9de9df26c8f1dd8e68702fb781

Contents?: true

Size: 661 Bytes

Versions: 8

Compression:

Stored size: 661 Bytes

Contents

require 'spec_helper'

describe Shb::Client do
  before do 
    stub_request(:any, 'supremegolf.com').to_return {|r| 
      {
        body: '{"one":1}', 
        headers: {'Content-Type' => 'application/json'}
      }
    }
    stub_request(:any, 'supremegolf.com/bad-json').to_return {|r| 
      {
        body: '{missing_first_double_quote":1}', 
        headers: {'Content-Type' => 'application/json'}
      }
    }
  end
  let(:shb) { Shb::Client.new }

  specify { expect(shb.get('/').parsed_response).to be_a Hash }
  specify { expect(shb.get('/').parsed_response['one']).to eq 1 }
  specify { expect(shb.get('/bad-json').parsed_response).to eq nil }
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shb-0.1.4 spec/json_spec.rb
shb-0.1.3 spec/json_spec.rb
shb-0.1.2 spec/json_spec.rb
shb-0.1.1 spec/json_spec.rb
shb-0.1.0 spec/json_spec.rb
shb-0.0.4 spec/json_spec.rb
shb-0.0.3 spec/json_spec.rb
shb-0.0.2 spec/json_spec.rb