Sha256: b976387e7d04bc6637ca5d54623d5557cf0e41d072509bdbc5f7ad13b3a7a55a

Contents?: true

Size: 723 Bytes

Versions: 51

Compression:

Stored size: 723 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
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
lhs-6.6.1 spec/item/setter_spec.rb
lhs-6.6.0 spec/item/setter_spec.rb
lhs-6.5.0 spec/item/setter_spec.rb
lhs-6.4.0 spec/item/setter_spec.rb
lhs-6.3.1 spec/item/setter_spec.rb
lhs-6.3.0 spec/item/setter_spec.rb
lhs-6.2.0 spec/item/setter_spec.rb
lhs-6.1.0 spec/item/setter_spec.rb
lhs-6.0.0 spec/item/setter_spec.rb
lhs-5.7.1 spec/item/setter_spec.rb
lhs-5.7.0 spec/item/setter_spec.rb
lhs-5.6.6 spec/item/setter_spec.rb
lhs-5.6.5 spec/item/setter_spec.rb
lhs-5.6.4 spec/item/setter_spec.rb
lhs-5.6.3 spec/item/setter_spec.rb
lhs-5.6.2 spec/item/setter_spec.rb
lhs-5.6.1 spec/item/setter_spec.rb
lhs-5.6.0 spec/item/setter_spec.rb
lhs-5.5.0 spec/item/setter_spec.rb
lhs-5.4.2 spec/item/setter_spec.rb