create_tests 0.0.1 → 0.1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/create_tests.rb +13 -9
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a615c53cdb13474c288476a703af9892273a1101f9f59e09868e946936dd1405
4
- data.tar.gz: 5a0e66501f3d56f64b986d6d0a26471d009a0c89ddc72917b25fcf5236ac1a46
3
+ metadata.gz: b91131d5885219c0ddd0605390abae3841e2673bd65043abb86e32ee26e9c8ed
4
+ data.tar.gz: 65da48eada00e686ff2de0092fc1932ed36dde338db792eb2715b4b7a28c28cd
5
5
  SHA512:
6
- metadata.gz: 9b5bd11485c8bcc6e956c1273d1d3e944b8761da13de7809227de17209dfcb4362e0e0d3774c23a1773774bd3e6297de7e3547a0e954a234ec4502a2b89f4cfe
7
- data.tar.gz: 9261e37cd606b616391c4061c0bd44fae437598bd3e604c960a7de24d1466014bc8f395385effe9f6a81584bc0ecaa79d16b68c20796cbe82f7d4cb2e2c0688e
6
+ metadata.gz: d71f2375f5db53b3071a0a321bd249a4ec2b86c9a4cc196763f6ca7f3b71b4b6c3c268e7d1a6272deb19507f19041a548828cd660706036a6a420a428ce5276b
7
+ data.tar.gz: bc6ff7b268fe2d1acaee4e268cf716635eb498403f7b16d3a80074fab32d9822b63f2c959b30a398c76be4dab7fa8867f80d2a043da2561dde0cb0d606a3a65a
data/README.md CHANGED
@@ -91,7 +91,7 @@ create_tests ./requests/uber.yaml.rb
91
91
  - Helper: ./spec/helper.rb
92
92
  ```
93
93
 
94
- You can see a reproduction of what we did before on here: https://github.com/MarioRuiz/create_tests/example
94
+ You can see a reproduction of what we did before on here: https://github.com/MarioRuiz/create_tests/tree/master/example
95
95
 
96
96
  ## Parameters
97
97
 
data/lib/create_tests.rb CHANGED
@@ -321,14 +321,17 @@ class CreateTests
321
321
  "
322
322
  end
323
323
 
324
- tests["it 'doesn\\'t retrieve data if not authenticated'"] = "do
324
+ title = "it 'doesn\\'t retrieve data if not authenticated'"
325
+ tests[title] = "do
325
326
  @http.headers = {}
326
327
  resp = @http.#{request[:method]}(@request)
327
- expect(resp.code).to be_between('400', '499')
328
- expect(NiceHash.compare_structure(@request.responses[resp.code.to_sym].data, resp.data.json)).to eq true
329
- expect(resp.message).to eq @request.responses[resp.code.to_sym].message
330
- end
331
- "
328
+ expect(resp.code).to be_between('400', '499')\n"
329
+ if request.key?(:responses) and (request[:responses].keys.select{|c| c.to_s.to_i>=400&&c.to_s.to_i<=499}).size>0
330
+ tests[title] += "expect(NiceHash.compare_structure(@request.responses[resp.code.to_sym].data, resp.data.json)).to eq true
331
+ expect(resp.message).to eq @request.responses[resp.code.to_sym].message\n"
332
+ end
333
+ tests[title] += "end\n"
334
+
332
335
  if params.size > 0
333
336
  missing_param = ""
334
337
  params.each do |p|
@@ -336,9 +339,10 @@ class CreateTests
336
339
  missing_param += "
337
340
  request = #{r}
338
341
  resp = @http.#{request[:method]}(request)
339
- expect(resp.code).to be_between('400', '499')
340
- expect(resp.message).to match /\#{request.responses[resp.code.to_sym].message}/i
341
- "
342
+ expect(resp.code).to be_between('400', '499')\n"
343
+ if request.key?(:responses) and (request[:responses].keys.select{|c| c.to_s.to_i>=400&&c.to_s.to_i<=499}).size>0
344
+ missing_param += "expect(resp.message).to match /\#{request.responses[resp.code.to_sym].message}/i\n"
345
+ end
342
346
  end
343
347
  missing_param += "end\n"
344
348
  tests["it 'returns error if required parameter missing' "] = "do\n#{missing_param}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-02 00:00:00.000000000 Z
11
+ date: 2019-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rufo