Sha256: 37f3b1fdf2823973dcb154d35255b15e818f760822358f95c0f23268ba5b165d

Contents?: true

Size: 861 Bytes

Versions: 9

Compression:

Stored size: 861 Bytes

Contents

require 'rails_helper'

describe LHS::Endpoint do

  context 'for url' do

    before(:each) do
      class SomeService < LHS::Service
        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://datastore.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://datastore.local.ch/123/feedbacks').url
      ).to eq ':datastore/:campaign_id/feedbacks'
      expect(
        LHS::Endpoint.for_url('http://datastore.local.ch/feedbacks').url
      ).to eq ':datastore/feedbacks'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lhs-1.3.1 spec/endpoint/for_url_spec.rb
lhs-1.3.0 spec/endpoint/for_url_spec.rb
lhs-1.2.3 spec/endpoint/for_url_spec.rb
lhs-1.2.2 spec/endpoint/for_url_spec.rb
lhs-1.2.1 spec/endpoint/for_url_spec.rb
lhs-1.2.0 spec/endpoint/for_url_spec.rb
lhs-1.1.0 spec/endpoint/for_url_spec.rb
lhs-1.0.0 spec/endpoint/for_url_spec.rb
lhs-0.4.0 spec/endpoint/for_url_spec.rb