Sha256: 09e00f3d13c047677c079147bb6f9233e5d57e35d5b56ae1f8a29e83393f5b7c

Contents?: true

Size: 889 Bytes

Versions: 19

Compression:

Stored size: 889 Bytes

Contents

require 'rails_helper'

describe LHS::Item do
  before do
    class Record < LHS::Record
      endpoint '{+datastore}/v2/{campaign_id}/feedbacks'
      endpoint '{+datastore}/v2/feedbacks'
    end
  end

  let(:json) do
    load_json(:feedbacks)
  end

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

  let(:item) do
    data[0]
  end

  context 'item setter' do
    it 'sets the value for an existing attribute' do
      expect((item.name = 'Steve')).to eq 'Steve'
      expect(item.name).to eq 'Steve'
      expect(item._raw[:name]).to eq 'Steve'
    end

    it 'sets things to nil' do
      item.name = 'Steve'
      expect((item.name = nil)).to eq nil
      expect(item.name).to eq nil
    end

    it 'sets things to false' do
      item.recommended = true
      expect((item.recommended = false)).to eq false
      expect(item.recommended).to eq false
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lhs-16.1.5 spec/item/setter_spec.rb
lhs-16.1.4 spec/item/setter_spec.rb
lhs-16.1.3 spec/item/setter_spec.rb
lhs-16.1.2 spec/item/setter_spec.rb
lhs-16.1.1 spec/item/setter_spec.rb
lhs-16.1.0 spec/item/setter_spec.rb
lhs-16.0.1 spec/item/setter_spec.rb
lhs-16.0.0 spec/item/setter_spec.rb
lhs-15.7.0 spec/item/setter_spec.rb
lhs-15.6.1 spec/item/setter_spec.rb
lhs-15.6.0 spec/item/setter_spec.rb
lhs-15.5.1 spec/item/setter_spec.rb
lhs-15.5.0 spec/item/setter_spec.rb
lhs-15.4.1 spec/item/setter_spec.rb
lhs-15.4.0 spec/item/setter_spec.rb
lhs-15.4.0.pre.hasone.1 spec/item/setter_spec.rb
lhs-15.3.3 spec/item/setter_spec.rb
lhs-15.3.3.pre.fixoptions.1 spec/item/setter_spec.rb
lhs-15.3.2 spec/item/setter_spec.rb