Sha256: e5ee81c42edee44bdaf5163fda14bd4a639c2047cdac72434affbcf8b4ccf864

Contents?: true

Size: 678 Bytes

Versions: 43

Compression:

Stored size: 678 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', 'Content-Type' => 'application/json' })
        .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

43 entries across 43 versions & 1 rubygems

Version Path
lhc-8.1.1 spec/response/data_accessor_spec.rb
lhc-9.0.0 spec/response/data_accessor_spec.rb
lhc-8.1.0 spec/response/data_accessor_spec.rb
lhc-8.0.0 spec/response/data_accessor_spec.rb
lhc-7.3.3 spec/response/data_accessor_spec.rb
lhc-7.3.2 spec/response/data_accessor_spec.rb
lhc-7.3.1 spec/response/data_accessor_spec.rb
lhc-7.3.0 spec/response/data_accessor_spec.rb
lhc-7.2.0 spec/response/data_accessor_spec.rb
lhc-7.1.0 spec/response/data_accessor_spec.rb
lhc-7.0.1 spec/response/data_accessor_spec.rb
lhc-7.0.0 spec/response/data_accessor_spec.rb
lhc-7.0.0.beta1 spec/response/data_accessor_spec.rb
lhc-6.7.2 spec/response/data_accessor_spec.rb
lhc-6.7.1 spec/response/data_accessor_spec.rb
lhc-6.7.0 spec/response/data_accessor_spec.rb
lhc-6.6.0.zipkin.pre.03 spec/response/data_accessor_spec.rb
lhc-6.6.0.zipkin.pre.02 spec/response/data_accessor_spec.rb
lhc-6.6.0.zipkin.pre.01 spec/response/data_accessor_spec.rb
lhc-6.6.0.zipkin.pre spec/response/data_accessor_spec.rb