Sha256: 8d5dfc43333e521c6bffa62eed5625be3118114d577cef4f7f35e6908a075c45

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'rails_helper'

describe LHC::Endpoint do
  context 'match' do
    context 'matching' do
      it 'checks if a url matches a template' do
        {
          ':datastore/v2/places' => 'http://local.ch:8082/v2/places',
          ':datastore/v2/places/:id' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
          ':datastore/v2/places/:namespace/:id' => 'http://local.ch:8082/v2/places/switzerland/ZW9OJyrbt'
        }.each do |template, url|
          expect(
            described_class.match?(url, template)
          ).to be, "#{url} should match #{template}!"
        end
      end
    end

    context 'not matching' do
      it 'checks if a url matches a template' do
        {
          ':datastore/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
          ':datastore/:campaign_id/feedbacks' => 'http://datastore.local.ch/feedbacks'
        }.each do |template, url|
          expect(
            described_class.match?(url, template)
          ).not_to be, "#{url} should not match #{template}!"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lhc-3.5.1 spec/endpoint/match_spec.rb
lhc-3.5.0 spec/endpoint/match_spec.rb