Sha256: e6208b4e8767b7e8a77f877a233f88bf958d85612e804902dcf85f0141533757

Contents?: true

Size: 963 Bytes

Versions: 7

Compression:

Stored size: 963 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 'destroy' do

    it 'destroys the item on the backend' do
      stub_request(:delete, 'http://datastore-stg.lb-service.sunrise.intra.local.ch/v2/feedbacks/0sdaetZ-OWVg4oBiBJ-7IQ')
      .to_return(status: 200)
      expect(item.destroy._raw).to eq item._raw
    end

    it 'updates the request information on the item' do
      no_content = 204
      stub_request(:delete, 'http://datastore-stg.lb-service.sunrise.intra.local.ch/v2/feedbacks/0sdaetZ-OWVg4oBiBJ-7IQ')
      .to_return(status: no_content)
      expect(item.destroy._request.response.code).to eq no_content
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lhs-1.2.2 spec/item/destroy_spec.rb
lhs-1.2.1 spec/item/destroy_spec.rb
lhs-1.2.0 spec/item/destroy_spec.rb
lhs-1.1.0 spec/item/destroy_spec.rb
lhs-1.0.0 spec/item/destroy_spec.rb
lhs-0.4.0 spec/item/destroy_spec.rb
lhs-0.3.0 spec/item/destroy_spec.rb