Sha256: eebf0ef0db543734001d4d15388f16472f6bfd2c3439c4ca1c8b116784ec1b25

Contents?: true

Size: 616 Bytes

Versions: 16

Compression:

Stored size: 616 Bytes

Contents

require 'rails_helper'

describe LHS::Item do
  before(:each) do
    class Record < LHS::Record
      endpoint '{+datastore}/records'
    end
  end

  let(:json) do
    {
      local_entry_id: 'ABC123'
    }
  end

  let(:item) do
    LHS::Data.new(json, nil, Record)
  end

  it 'is possible to fetch data' do
    expect(
      item.fetch(:local_entry_id)
    ).to eq 'ABC123'
  end

  context 'empty data' do
    let(:json) do
      {}
    end

    it 'is possible to get a default when fetched data is nil' do
      expect(
        item.fetch(:local_entry_id, 'DEFAULT')
      ).to eq 'DEFAULT'
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lhs-15.3.1 spec/item/fetch_spec.rb
lhs-15.3.1.pre.fixlhc.1 spec/item/fetch_spec.rb
lhs-15.3.0 spec/item/fetch_spec.rb
lhs-15.2.5 spec/item/fetch_spec.rb
lhs-15.2.4 spec/item/fetch_spec.rb
lhs-15.2.3 spec/item/fetch_spec.rb
lhs-15.2.3.pre.favorites.1 spec/item/fetch_spec.rb
lhs-15.2.2.pre.favorites.1 spec/item/fetch_spec.rb
lhs-15.2.2 spec/item/fetch_spec.rb
lhs-15.2.1 spec/item/fetch_spec.rb
lhs-15.2.0 spec/item/fetch_spec.rb
lhs-15.1.1 spec/item/fetch_spec.rb
lhs-15.1.0 spec/item/fetch_spec.rb
lhs-15.0.2 spec/item/fetch_spec.rb
lhs-15.0.1 spec/item/fetch_spec.rb
lhs-15.0.0 spec/item/fetch_spec.rb