lhc 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe809e75fd7e92b7d3845d46bf14ce442a3c4dcd
4
- data.tar.gz: ac02526096a42014c15efbab2bb5d6540f102620
3
+ metadata.gz: 433be6f02c1ccf13d4371eb4ce4f494459f95bda
4
+ data.tar.gz: 1d1f479f03152e50798da81183673c6adc0b15d8
5
5
  SHA512:
6
- metadata.gz: d5f71fb2d3d35ee089e1e088ec77150106baf344b58d5278d5299a1b957151b2afe7d3e6d7f5b7243122e290f882346587e1f31a574058fa965157aa8acc2a24
7
- data.tar.gz: 6651ce9efbbc0ce48ac4c28ce3e87fee172c741b5b0d60cb8d75741fa45a7ad8c0b60dc998d9b41734b43d75b9653b23beb5208b771cc05ed3eff693d8e8d7ae
6
+ metadata.gz: 334d1f083f02164608ea72a104c2b749510525eb405346b11923f7ca154250d8e9fba5f69b9bad8d2f184839c60a892bf071317d56696c4666d292ff96ccc3e4
7
+ data.tar.gz: 363288f5578543311ba1f00c886cc64cca9ea1fe170946946f9adca8bc394169d8e79055f6ee06a4d4585858ce0aba0d145efec8f3c5184b653203141f26f4d0
@@ -58,6 +58,7 @@ class LHC::Endpoint
58
58
  LHC::Endpoint.placeholders(template).each do |placeholder|
59
59
  regexp = regexp.gsub(placeholder, '.*')
60
60
  end
61
+ regexp = regexp.gsub('/', '(?<!/)/(?!/)')
61
62
  url.match(Regexp.new("^#{regexp}$"))
62
63
  end
63
64
 
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -7,13 +7,13 @@ describe LHC::Endpoint do
7
7
  context 'matching' do
8
8
  it 'checks if a url matches a template' do
9
9
  {
10
- ':datastore/v2/places' => 'http://silo1.intra.local.ch:8082/v2/places',
11
- ':datastore/v2/places/:id' => 'http://silo1.intra.local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
12
- ':datastore/v2/places/:namespace/:id' => 'http://silo1.intra.local.ch:8082/v2/places/switzerland/ZW9OJyrbt'
10
+ ':datastore/v2/places' => 'http://local.ch:8082/v2/places',
11
+ ':datastore/v2/places/:id' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
12
+ ':datastore/v2/places/:namespace/:id' => 'http://local.ch:8082/v2/places/switzerland/ZW9OJyrbt'
13
13
  }.each do |template, url|
14
14
  expect(
15
15
  LHC::Endpoint.match?(url, template)
16
- ).to be
16
+ ).to be, "#{url} should match #{template}!"
17
17
  end
18
18
  end
19
19
  end
@@ -21,11 +21,12 @@ describe LHC::Endpoint do
21
21
  context 'not matching' do
22
22
  it 'checks if a url matches a template' do
23
23
  {
24
- ':datastore/v2/places' => 'http://silo1.intra.local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A'
24
+ ':datastore/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
25
+ ':datastore/:campaign_id/feedbacks' => 'http://datastore.local.ch/feedbacks'
25
26
  }.each do |template, url|
26
27
  expect(
27
28
  LHC::Endpoint.match?(url, template)
28
- ).not_to be
29
+ ).not_to be, "#{url} should not match #{template}!"
29
30
  end
30
31
  end
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - local.ch