mocktopus 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b877728ade4eef3fa2a5920d8b5e431c33f67e2
4
- data.tar.gz: 5445c957d732bbb07aae5d86d881da4dc56b4233
3
+ metadata.gz: 11ec3b399dd8e0d153c4329b0391620d0c24d6f9
4
+ data.tar.gz: ff552697227fb4933a3960c01881297563d78519
5
5
  SHA512:
6
- metadata.gz: 3a85c6c03f4b2fe97628b2f91c117b9f3d05c3ee419fb063aad38c9c4e538c58e92eff1ebc4041050c828c3f27ca66373200e4cd601d3320b46dad69b31c2a4f
7
- data.tar.gz: 9c74f7f67041a09cd29133e20295ecdfaa23061c19baab3d25c0bf49cb156b42989bb6e71c0d1b296e24cc1f550e678e650eb022dd36668a7d6af269b801d8a0
6
+ metadata.gz: c03d2ea29fe2f2105b22db27478561867d4a5cbb6910990fd4446ea3417c7365aa5d2e50478dc7f1ff5089f5329d01e6cb9bde1f0efc4e07dd99fd8aace90a1a
7
+ data.tar.gz: a9ad5adaef8070c71de1ba0e0b316dad2bc30a5b9f26e8d0a751da0e188c7944fafb2bf2a28d1acd9e1972dea6534dc1b197e1314649e8fe45e5fd2f392a6329
@@ -10,22 +10,16 @@ module Mocktopus
10
10
  port_option = args.include?('-p') ? '' : ' -p 8081'
11
11
  args = args.join(' ')
12
12
  command = "bundle exec thin -R #{ENV['CONFIG_RU'] || 'config.ru'} start#{port_option} #{args}"
13
- run_command(command)
13
+ Kernel.system(command)
14
14
  end
15
15
 
16
16
  desc "stop", "stops the mocktopus"
17
17
  def stop
18
18
  command = "bundle exec thin stop"
19
- run_command(command)
19
+ Kernel.system(command)
20
20
  end
21
21
 
22
22
  map 's' => :start
23
-
24
- private
25
-
26
- def run_command(command)
27
- system(command)
28
- end
29
23
 
30
24
  end
31
25
  end
@@ -18,7 +18,8 @@ module Mocktopus
18
18
  :body,
19
19
  :url_parameters,
20
20
  :verb,
21
- :response
21
+ :response,
22
+ :skip_body
22
23
 
23
24
  def initialize(hash, response)
24
25
 
@@ -46,7 +47,7 @@ module Mocktopus
46
47
  @body = body
47
48
  @verb = hash['verb'].upcase
48
49
  @response = response
49
-
50
+ @skip_body = (hash['skip_body'] || false).eql? true
50
51
  validate_instance_variables
51
52
 
52
53
  $logger.debug("initialized input object from hash #{hash.inspect()}")
@@ -41,7 +41,7 @@ module Mocktopus
41
41
  result = nil
42
42
  matches = inputs.select{|v| URI.decode(v.uri).eql?(URI.decode(path)) &&
43
43
  headers_match?(headers, v.headers) &&
44
- bodies_match?(v.body, body) &&
44
+ (v.skip_body || bodies_match?(v.body, body)) &&
45
45
  v.verb.eql?(verb) &&
46
46
  v.url_parameters.eql?(url_parameters) }
47
47
  case matches.size
@@ -56,6 +56,7 @@ module Mocktopus
56
56
  end
57
57
 
58
58
  private
59
+
59
60
  def headers_match?(input_headers, match_headers)
60
61
  match = true
61
62
  if (match_headers != nil)
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'mocktopus'
5
- s.version = '0.1.2'
6
- s.date = '2016-08-25'
5
+ s.version = '0.1.3'
6
+ s.date = '2017-03-14'
7
7
  s.required_ruby_version = '>= 2.0.0'
8
8
 
9
9
  s.summary = 'A configurable mock Web API'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mocktopus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rackspace
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra