Sha256: 28d62156d78c1310e41bf8595e3bbf7a9ddbeee421dfb9f432760d7662bb2768

Contents?: true

Size: 733 Bytes

Versions: 15

Compression:

Stored size: 733 Bytes

Contents

require 'rails_helper'

describe LHS::Item do

  before(:each) do
    class SomeService < LHS::Service
      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, SomeService)
  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

15 entries across 15 versions & 1 rubygems

Version Path
lhs-1.6.1 spec/item/setter_spec.rb
lhs-1.6.0 spec/item/setter_spec.rb
lhs-2.0.0 spec/item/setter_spec.rb
lhs-1.5.0 spec/item/setter_spec.rb
lhs-1.4.0 spec/item/setter_spec.rb
lhs-1.3.1 spec/item/setter_spec.rb
lhs-1.3.0 spec/item/setter_spec.rb
lhs-1.2.3 spec/item/setter_spec.rb
lhs-1.2.2 spec/item/setter_spec.rb
lhs-1.2.1 spec/item/setter_spec.rb
lhs-1.2.0 spec/item/setter_spec.rb
lhs-1.1.0 spec/item/setter_spec.rb
lhs-1.0.0 spec/item/setter_spec.rb
lhs-0.4.0 spec/item/setter_spec.rb
lhs-0.3.0 spec/item/setter_spec.rb