backdrop 0.2.2 → 0.2.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjRhY2VhYTg3NjFiZTllZDhmZDAwNWE5Y2RjODU2ZTRjNDJmOWQ3ZQ==
4
+ NGM0ZTA1MDE5N2E3ZGE1MmI2YmE3ZDJlNDY5MThlMjRiZjAwNTYzMA==
5
5
  data.tar.gz: !binary |-
6
- YmQ3ZWZmNjM1YWQ3Y2VhYjY1YWQwOTE3ZDAwMWVlMDA3NmFkYjkxOA==
6
+ ZWEwZjllNjk4N2MzM2YwZTJiOTgzN2E5YmVjZjA2NzEwYzkxZWUyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGRkY2QxMTUzYzNmMmI1ZTAxOTdhY2MxZDA5NWQ1YTc1NTc5NTU2OTVkOTMw
10
- MjAxY2IyNWRjZTdlYjM2MThjZmFkYjdhYmMyOTg2OWQwYWJhMjNmOTdhZDM1
11
- MmM2OWIwM2IxM2M4OTVmNzQ3NTM5MzM2Mjk4Yjg2OGQ4MGZjNjQ=
9
+ YmVjODEyOTE0OTMyOGUwOWQ1YjY4Nzk0NTAyZjZhOThmYTJjOGU2MWVkYjUx
10
+ NTBjMzUxOGNjNmRlNDUwZDlhOThiNmVhODNhODlmODEzYzY2MTJhZTUyZWQ5
11
+ MTA5MjgwMmY2MmQ1ODAzOGVmOTAwMmZiMmUzMWZkY2UwZDUxYzY=
12
12
  data.tar.gz: !binary |-
13
- ODAwMTcyOTA5YzU4MTY5YzZhNWEyZjg4YzE0MTRjMzE5MTAzNTQ5YTBmMDEw
14
- ZWIwMzJmMjhlODI4MDA1MDA4NzIzYjM4YTk1MDk4MThjMmJiZWU2NDMzYmM1
15
- MDU2NWQ3YzVhM2IzOWIzYTRhNzVkNmI1ZGUxMTczNTg1Mjg0ZDQ=
13
+ Zjk0MTRlNzgzNjhmMDQ5YzMxNWJiODA0ZDRlMDZjYWMzZDMyNDQ0MjI5Zjg2
14
+ ZjhiYjZmYzFjMDk0OGQ1NTcxNzZmMDk5MjgwNGUzYThkYTFiMDU5ODg2MTAz
15
+ YTE1OTdlNGQ5ODg4OTFhYjM3MjAxOWRjMDllM2IwZWE5Yjc1ZDA=
@@ -1,7 +1,7 @@
1
1
  module Backdrop
2
2
  class Builder
3
3
  def build_response(output, project, data, response)
4
- file = data['requests'].first['request_path']
4
+ file = data['requests'].first['request_path'].split('?')[0]
5
5
  method = data['http_method'].downcase
6
6
  path = File.dirname file
7
7
  filename = File.basename file
@@ -1,3 +1,3 @@
1
1
  module Backdrop
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -12,23 +12,48 @@ describe Backdrop::Builder do
12
12
  FileUtils.remove_entry_secure @output_dir
13
13
  end
14
14
 
15
- let(:sample_data) do
16
- { 'http_method' => 'GET',
17
- 'route' => '/project/:property',
18
- 'requests' => [{
19
- 'request_path' => '/resource/get_request',
20
- 'response_body' => '{"Hello":"World"}'
21
- }] }
15
+ context 'when the path has no query params' do
16
+
17
+ let(:sample_data) do
18
+ { 'http_method' => 'GET',
19
+ 'route' => '/project/:property',
20
+ 'requests' => [{
21
+ 'request_path' => '/resource/get_request',
22
+ 'response_body' => '{"Hello":"World"}'
23
+ }] }
24
+ end
25
+ let(:project) { 'project' }
26
+ let(:response) { 'some response' }
27
+
28
+ it 'creates the response file with given input' do
29
+ subject.build_response(@output_dir, project, sample_data, response)
30
+ output = File.read(
31
+ "#{File.join(@output_dir, 'project', '/resource/get_request')}.get"
32
+ )
33
+ expect(output).to eq response
34
+ end
22
35
  end
23
- let(:project) { 'project' }
24
- let(:response) { 'some response' }
25
-
26
- it 'creates the response file with given input' do
27
- subject.build_response(@output_dir, project, sample_data, response)
28
- output = File.read(
29
- "#{File.join(@output_dir, 'project', '/resource/get_request')}.get"
30
- )
31
- expect(output).to eq response
36
+
37
+ context 'when the path has query params' do
38
+
39
+ let(:sample_data) do
40
+ { 'http_method' => 'GET',
41
+ 'route' => '/project/:property',
42
+ 'requests' => [{
43
+ 'request_path' => '/resource/get_request?query=something',
44
+ 'response_body' => '{"Hello":"World"}'
45
+ }] }
46
+ end
47
+ let(:project) { 'project' }
48
+ let(:response) { 'some response' }
49
+
50
+ it 'creates the response file, stripping the query params' do
51
+ subject.build_response(@output_dir, project, sample_data, response)
52
+ output = File.read(
53
+ "#{File.join(@output_dir, 'project', '/resource/get_request')}.get"
54
+ )
55
+ expect(output).to eq response
56
+ end
32
57
  end
33
58
  end
34
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Bowden