Sha256: d4fecf979daa247cdc104e418ceb4de74904f0991e7ad03006764d2b955c95f4
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
require 'rails_helper' describe LHC::Endpoint do context 'match' do context 'matching' 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', '{+datastore}/addresses/{id}' => 'http://local.ch/addresses/123', 'http://local.ch/addresses/{id}' => 'http://local.ch/addresses/123', '{+datastore}/customers/{id}/addresses' => 'http://local.ch:80/server/rest/v1/customers/123/addresses', '{+datastore}/entries/{id}.json' => 'http://local.ch/entries/123.json', '{+datastore}/places/{place_id}/feedbacks' => 'http://local.ch/places/1/feedbacks?limit=10&offset=0' }.each do |template, url| it "#{url} matches #{template}" do expect(LHC::Endpoint.match?(url, template)).to be end end end context 'not matching' do { '{+datastore}/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A', '{+datastore}/{campaign_id}/feedbacks' => 'http://datastore.local.ch/feedbacks', '{+datastore}/customers/{id}' => 'http://local.ch:80/server/rest/v1/customers/123/addresses', '{+datastore}/entries/{id}' => 'http://local.ch/entries/123.json' }.each do |template, url| it "#{url} should not match #{template}" do expect( LHC::Endpoint.match?(url, template) ).not_to be end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lhc-7.0.0 | spec/endpoint/match_spec.rb |
lhc-7.0.0.beta1 | spec/endpoint/match_spec.rb |