Sha256: 3c40a2a5d6cfd3e38b9479a411f0a0cd7a3aa040fc51d885cd0a96bbf781e5cb

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

RSpec.describe RatingChgkV2::Models::VenueModel do
  let!(:venue) do
    VCR.use_cassette('venues/venue') do
      test_client.venue 3601
    end
  end

  specify '#update' do
    stub_request(:put, 'https://api.rating.chgk.net/venues/3601').
      with(body: {name: 'Обновлённая'}).
      to_return(
        status: 201,
        body: '{"id":3601,"name":"Обновлённая"}',
        headers: {}
      )

    updated_venue = venue.update name: 'Обновлённая'
    expect(updated_venue).to be_an_instance_of(described_class)
    expect(updated_venue.name).to eq('Обновлённая')
    expect(updated_venue.id).to eq(3601)
  end

  specify '#destroy' do
    stub_request(:delete, 'https://api.rating.chgk.net/venues/3601').to_return(status: 204, body: '', headers: {})

    expect(venue.destroy).to eq('')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rating-chgk-v2-1.0.0 spec/lib/rating_chgk_v2/models/venue_model_spec.rb
rating-chgk-v2-1.0.0.rc1 spec/lib/rating_chgk_v2/models/venue_model_spec.rb