Sha256: c23ebdf88ce5a47eeecd5e61debf9878f81c86d2b152e1d23a5fd2c58dc81639

Contents?: true

Size: 891 Bytes

Versions: 79

Compression:

Stored size: 891 Bytes

Contents

require 'rails_helper'

describe LHS::Item do
  before(:each) 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

79 entries across 79 versions & 1 rubygems

Version Path
lhs-7.3.0 spec/item/setter_spec.rb
lhs-7.2.5 spec/item/setter_spec.rb
lhs-7.2.4 spec/item/setter_spec.rb
lhs-7.2.3 spec/item/setter_spec.rb
lhs-7.2.2 spec/item/setter_spec.rb
lhs-7.2.1 spec/item/setter_spec.rb
lhs-7.2.0 spec/item/setter_spec.rb
lhs-7.1.0 spec/item/setter_spec.rb
lhs-7.0.3 spec/item/setter_spec.rb
lhs-7.0.2 spec/item/setter_spec.rb
lhs-7.0.1 spec/item/setter_spec.rb
lhs-7.0.0 spec/item/setter_spec.rb
lhs-6.8.2 spec/item/setter_spec.rb
lhs-6.8.1 spec/item/setter_spec.rb
lhs-6.8.0 spec/item/setter_spec.rb
lhs-6.7.2 spec/item/setter_spec.rb
lhs-6.7.1 spec/item/setter_spec.rb
lhs-6.7.0 spec/item/setter_spec.rb
lhs-6.6.2 spec/item/setter_spec.rb