Sha256: ef46f1a537ca7fedc9e205284d80d1052e3b7bf6c675845bcc5ce13ccc96a96c

Contents?: true

Size: 865 Bytes

Versions: 76

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHS::Endpoint do
  context 'for url' do
    before do
      class Record < LHS::Record
        endpoint '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
        endpoint '{+datastore}/{campaign_id}/feedbacks'
        endpoint '{+datastore}/feedbacks'
      end
    end

    it 'provides the endpoint for a given url' do
      expect(
        LHS::Endpoint.for_url('http://local.ch/v2/entries/123/content-ads/456/feedbacks').url
      ).to eq '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
      expect(
        LHS::Endpoint.for_url('http://local.ch/123/feedbacks').url
      ).to eq '{+datastore}/{campaign_id}/feedbacks'
      expect(
        LHS::Endpoint.for_url('http://local.ch/feedbacks').url
      ).to eq '{+datastore}/feedbacks'
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
lhs-26.2.0 spec/endpoint/for_url_spec.rb
lhs-26.1.0 spec/endpoint/for_url_spec.rb
lhs-26.0.1 spec/endpoint/for_url_spec.rb
lhs-26.0.0 spec/endpoint/for_url_spec.rb
lhs-25.2.0 spec/endpoint/for_url_spec.rb
lhs-25.1.0 spec/endpoint/for_url_spec.rb
lhs-25.0.4 spec/endpoint/for_url_spec.rb
lhs-25.0.3 spec/endpoint/for_url_spec.rb
lhs-25.0.2 spec/endpoint/for_url_spec.rb
lhs-25.0.1 spec/endpoint/for_url_spec.rb
lhs-25.0.0 spec/endpoint/for_url_spec.rb
lhs-24.1.2 spec/endpoint/for_url_spec.rb
lhs-24.1.1 spec/endpoint/for_url_spec.rb
lhs-24.1.0 spec/endpoint/for_url_spec.rb
lhs-24.1.0.pre.2 spec/endpoint/for_url_spec.rb
lhs-24.1.0.pre.1 spec/endpoint/for_url_spec.rb
lhs-24.0.0 spec/endpoint/for_url_spec.rb
lhs-23.0.2 spec/endpoint/for_url_spec.rb
lhs-23.0.1 spec/endpoint/for_url_spec.rb
lhs-23.0.0 spec/endpoint/for_url_spec.rb