Sha256: d5235cc0769cae0703b472a0c7e38a86625359a70700e2ecad20a15e617fbaff

Contents?: true

Size: 708 Bytes

Versions: 18

Compression:

Stored size: 708 Bytes

Contents

require 'rails_helper'

describe LHC do
  context 'data accessor (hash with indifferent access)' do
    before(:each) do
      stub_request(:get, "http://local.ch/")
        .with(headers: { 'Accept' => 'application/json; charset=utf-8', 'Content-Type' => 'application/json; charset=utf-8' })
        .to_return(body: { 'MyProp' => 'MyValue' }.to_json)
    end

    it 'makes data accessible with square bracket accessor (string)' do
      expect(
        LHC.json.get('http://local.ch')['MyProp']
      ).to eq 'MyValue'
    end

    it 'makes data accessible with square bracket accessor (symbol)' do
      expect(
        LHC.json.get('http://local.ch')[:MyProp]
      ).to eq 'MyValue'
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
lhc-10.1.2 spec/response/data_accessor_spec.rb
lhc-10.1.1 spec/response/data_accessor_spec.rb
lhc-10.1.0 spec/response/data_accessor_spec.rb
lhc-10.0.2 spec/response/data_accessor_spec.rb
lhc-9.4.4 spec/response/data_accessor_spec.rb
lhc-10.0.1 spec/response/data_accessor_spec.rb
lhc-10.0.0 spec/response/data_accessor_spec.rb
lhc-9.4.3 spec/response/data_accessor_spec.rb
lhc-9.4.2 spec/response/data_accessor_spec.rb
lhc-9.4.1 spec/response/data_accessor_spec.rb
lhc-9.4.0 spec/response/data_accessor_spec.rb
lhc-9.3.1 spec/response/data_accessor_spec.rb
lhc-9.3.0 spec/response/data_accessor_spec.rb
lhc-9.2.0 spec/response/data_accessor_spec.rb
lhc-9.1.2 spec/response/data_accessor_spec.rb
lhc-9.1.2.pre spec/response/data_accessor_spec.rb
lhc-9.1.1 spec/response/data_accessor_spec.rb
lhc-9.1.0 spec/response/data_accessor_spec.rb