mockserver-client 1.0.7.pre → 1.0.7

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: d593d56d5c9005af9a6c183429add811ddec07b7
4
- data.tar.gz: 215e26cdc2d7c24295776e993fe7b51935d6da7a
3
+ metadata.gz: 0c9608d1182a5fd5dad69e1cf7589d75406b920d
4
+ data.tar.gz: ff425ace2962b277a43488a3a4e6d17bf1381e3a
5
5
  SHA512:
6
- metadata.gz: 60bba3c35b6ce13f25d935e11316654626e43eba0b8e6dad073ff80c8ffa98917d66044dd3f77e933e48b5ba50b1675845a6fc00e46f44eb648e72babb7efa6b
7
- data.tar.gz: 0984c9d95911dd75eda7fde1c5da379d63bd9ab912fcf0d043ae2fe5055ac982bcb7531029e13c2eca7ecfef94facb88b01f4c350caf1e9f40cd0f89301e4058
6
+ metadata.gz: bd48ddc76ee25042489a8c0c137eb1f772afe5fb8b089166edf5ae1ed31b0f57e6bdb3b0f2a12bce8ce0f58bc4a0d022fb9dda6c4fe8a3cc66d65c2d7c2ce428
7
+ data.tar.gz: 2230ffbaaca0adb85da49c696707a902c753032640962eadf005b6de3b11acb2312e780b9b8b78b0a933cddac78a6ed199459e4d30d6a804e6550557bb745523
data/README.md CHANGED
@@ -70,7 +70,7 @@ expectation = expectation do |expectation|
70
70
  expectation.request do |request|
71
71
  request.method = 'POST'
72
72
  request.path = '/login'
73
- request.query_parameters << parameter('returnUrl', '/account')
73
+ request.query_string_parameters << parameter('returnUrl', '/account')
74
74
  request.cookies = [cookie('sessionId', '2By8LOhBmaW5nZXJwcmludCIlMDAzMW')]
75
75
  request.body = exact("{username: 'foo', password: 'bar'}")
76
76
  end
@@ -26,7 +26,7 @@ module MockServer
26
26
  def initialize(host, port)
27
27
  fail 'Cannot instantiate AbstractClient class. You must subclass it.' if self.class == AbstractClient
28
28
  fail 'Host/port must not be nil' unless host && port
29
- @base = RestClient::Resource.new("http://#{host}:#{port}")
29
+ @base = RestClient::Resource.new("http://#{host}:#{port}", headers: { 'Content-Type' => 'application/json' })
30
30
  @logger = ::LoggingFactory::DEFAULT_FACTORY.log(self.class)
31
31
  end
32
32
 
@@ -68,11 +68,10 @@ module MockServer
68
68
 
69
69
  response = @base[RETRIEVE_ENDPOINT].put(request.to_json)
70
70
  logger.debug("Got retrieve response: #{response.code}")
71
- expectations = Expectations.new([])
72
- parse_string_to_json(response).map { |result| expectations << expectation_from_json(result) } unless response.empty?
73
- # expectations = Expectations.new([]).insert(0, (parse_string_to_json(response).map { |result| expectation_from_json(result) } unless response.empty?))
74
- expectations.code = response.code
75
- expectations
71
+ requests = Requests.new([])
72
+ parse_string_to_json(response.body).map { |result| requests << request_from_json(result) } unless response.empty?
73
+ requests.code = response.code
74
+ requests
76
75
  end
77
76
 
78
77
  # Request to dump logs to file
@@ -0,0 +1,36 @@
1
+ # encoding: UTF-8
2
+ require 'hashie'
3
+ require_relative './array_of'
4
+
5
+ #
6
+ # A class to model cookies in payloads.
7
+ # @author:: Nayyara Samuel (mailto: nayyara.samuel@opower.com)
8
+ #
9
+ module MockServer::Model
10
+ # Model for cookie
11
+ class Cookie < Hashie::Dash
12
+ include Hashie::Extensions::MethodAccess
13
+ include Hashie::Extensions::IgnoreUndeclared
14
+ include Hashie::Extensions::Coercion
15
+
16
+ property :name, required: true
17
+ property :value, required: true
18
+
19
+ coerce_key :name, String
20
+ coerce_key :value, String
21
+ end
22
+
23
+ # A collection that only stores cookies
24
+ class Cookies < ArrayOf
25
+ def child_class
26
+ Cookie
27
+ end
28
+ end
29
+
30
+ # DSL methods for cookie
31
+ module DSL
32
+ def cookie(key, value)
33
+ Cookie.new(name: key, value: value)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,43 @@
1
+ # encoding: UTF-8
2
+ require 'hashie'
3
+ require_relative './array_of'
4
+
5
+ #
6
+ # A class to model headers in payloads.
7
+ # @author:: Nayyara Samuel (mailto: nayyara.samuel@opower.com)
8
+ #
9
+ module MockServer::Model
10
+ # A class that only stores strings
11
+ class Strings < ArrayOf
12
+ def child_class
13
+ String
14
+ end
15
+ end
16
+
17
+ # Model for header
18
+ class Header < Hashie::Dash
19
+ include Hashie::Extensions::MethodAccess
20
+ include Hashie::Extensions::IgnoreUndeclared
21
+ include Hashie::Extensions::Coercion
22
+
23
+ property :name, required: true
24
+ property :values, default: Strings.new([])
25
+
26
+ coerce_key :name, String
27
+ coerce_key :values, Strings
28
+ end
29
+
30
+ # A collection that only stores headers
31
+ class Headers < ArrayOf
32
+ def child_class
33
+ Header
34
+ end
35
+ end
36
+
37
+ # DSL methods for header
38
+ module DSL
39
+ def header(key, *value)
40
+ Header.new(name: key, values: value)
41
+ end
42
+ end
43
+ end
@@ -39,8 +39,5 @@ module MockServer::Model
39
39
  def parameter(key, *value)
40
40
  Parameter.new(name: key, values: value)
41
41
  end
42
-
43
- alias_method :cookie, :parameter
44
- alias_method :header, :parameter
45
42
  end
46
43
  end
@@ -1,6 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  require 'hashie'
3
3
  require_relative './parameter'
4
+ require_relative './header'
5
+ require_relative './cookie'
4
6
  require_relative './body'
5
7
  require_relative './enum'
6
8
  require 'base64'
@@ -26,9 +28,9 @@ module MockServer::Model
26
28
 
27
29
  property :method, required: true, default: :GET
28
30
  property :path, required: true, default: ''
29
- property :query_parameters, default: Parameters.new([])
30
- property :cookies, default: Parameters.new([])
31
- property :headers, default: Parameters.new([])
31
+ property :query_string_parameters, default: Parameters.new([])
32
+ property :cookies, default: Cookies.new([])
33
+ property :headers, default: Headers.new([])
32
34
  property :body, transform_with: (lambda do |body|
33
35
  is_base_64_body = body && body.type == :BINARY
34
36
  body_value = is_base_64_body ? Base64.decode64(body.value) : body.value
@@ -37,10 +39,27 @@ module MockServer::Model
37
39
 
38
40
  coerce_key :method, HTTPMethod
39
41
  coerce_key :path, String
40
- coerce_key :query_parameters, Parameters
41
- coerce_key :cookies, Parameters
42
- coerce_key :headers, Parameters
42
+ coerce_key :query_string_parameters, Parameters
43
+ coerce_key :cookies, Cookies
44
+ coerce_key :headers, Headers
43
45
  coerce_key :body, Body
46
+
47
+ # Creates a request from a hash
48
+ # @param payload [Hash] a hash representation of the request
49
+ def populate_from_payload(payload)
50
+ @request = payload[MockServer::HTTP_REQUEST]
51
+ @request = Request.new(symbolize_keys(@request)) if @request
52
+ end
53
+ end
54
+
55
+ # Class to store a list of mocks - useful for modeling retrieve endpoint result
56
+ class Requests < ArrayOf
57
+ # Code is used to store HTTP status code returned from retrieve endpoint
58
+ attr_accessor :code
59
+
60
+ def child_class
61
+ Request
62
+ end
44
63
  end
45
64
 
46
65
  # DSL methods related to requests
@@ -51,6 +70,12 @@ module MockServer::Model
51
70
  obj
52
71
  end
53
72
 
73
+ def request_from_json(payload)
74
+ request = Request.new(symbolize_keys(payload))
75
+ yield request if block_given?
76
+ request
77
+ end
78
+
54
79
  alias_method :http_request, :request
55
80
  end
56
81
  end
@@ -1,7 +1,8 @@
1
1
  # encoding: UTF-8
2
2
  require_relative './body'
3
3
  require_relative './delay'
4
- require_relative './parameter'
4
+ require_relative './header'
5
+ require_relative './cookie'
5
6
  require 'base64'
6
7
 
7
8
  #
@@ -16,13 +17,13 @@ module MockServer::Model
16
17
  include Hashie::Extensions::Coercion
17
18
 
18
19
  property :status_code, default: 200
19
- property :cookies, default: Parameters.new([])
20
- property :headers, default: Parameters.new([])
20
+ property :cookies, default: Cookies.new([])
21
+ property :headers, default: Headers.new([])
21
22
  property :delay
22
23
  property :body
23
24
 
24
- coerce_key :cookies, Parameters
25
- coerce_key :headers, Parameters
25
+ coerce_key :cookies, Cookies
26
+ coerce_key :headers, Headers
26
27
  coerce_key :delay, Delay
27
28
  coerce_key :body, String
28
29
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  # Version for this gem
3
3
  module MockServer
4
- VERSION = '1.0.7.pre'
4
+ VERSION = '1.0.7'
5
5
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = 'A Ruby Client for MockServer that enables easy mocking of any system you integrate with via HTTP or HTTPS (i.e. services, web sites, etc)'
14
14
 
15
15
  spec.required_ruby_version = '>= 1.9'
16
- spec.required_rubygems_version = '~> 2'
16
+ spec.required_rubygems_version = '~> 2.0'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0")
19
19
  spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
@@ -21,17 +21,17 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ['lib']
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1'
24
- spec.add_development_dependency 'rake', '~> 10.3.2'
25
- spec.add_development_dependency 'rspec', '~> 3.0.0'
26
- spec.add_development_dependency 'simplecov', '~> 0.8.2'
24
+ spec.add_development_dependency 'rake', '~> 10.3'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ spec.add_development_dependency 'simplecov', '~> 0.8'
27
27
  spec.add_development_dependency 'webmock', '~> 1.18'
28
- spec.add_development_dependency 'rubocop', '~> 0.23.0'
28
+ spec.add_development_dependency 'rubocop', '~> 0.23'
29
29
 
30
30
  spec.add_dependency 'hashie', '~> 3.0'
31
- spec.add_dependency 'json', '~> 1.8.1'
32
- spec.add_dependency 'activesupport', '~> 4.2.0'
33
- spec.add_dependency 'rest-client', '~> 1.7.2'
31
+ spec.add_dependency 'json', '~> 1.8'
32
+ spec.add_dependency 'activesupport', '~> 4.1'
33
+ spec.add_dependency 'rest-client', '~> 1.7'
34
34
  spec.add_dependency 'logging_factory', '~> 0.0.2'
35
- spec.add_dependency 'thor', '~> 0.19.1'
36
- spec.add_dependency 'colorize', '~> 0.7.0'
35
+ spec.add_dependency 'thor', '~> 0.19'
36
+ spec.add_dependency 'colorize', '~> 0.7'
37
37
  end
data/pom.xml CHANGED
@@ -3,7 +3,7 @@
3
3
  <parent>
4
4
  <groupId>org.mock-server</groupId>
5
5
  <artifactId>mockserver</artifactId>
6
- <version>3.9.17-SNAPSHOT</version>
6
+ <version>3.10.2-SNAPSHOT</version>
7
7
  </parent>
8
8
  <modelVersion>4.0.0</modelVersion>
9
9
 
@@ -19,6 +19,34 @@
19
19
 
20
20
  <build>
21
21
  <plugins>
22
+ <!-- run mock server for ruby client tests -->
23
+ <plugin>
24
+ <groupId>${project.groupId}</groupId>
25
+ <artifactId>mockserver-maven-plugin</artifactId>
26
+ <version>${project.version}</version>
27
+ <configuration>
28
+ <logLevel>WARN</logLevel>
29
+ <serverPort>1080</serverPort>
30
+ <proxyPort>1090</proxyPort>
31
+ </configuration>
32
+ <executions>
33
+ <execution>
34
+ <id>pre-test</id>
35
+ <phase>generate-test-sources</phase>
36
+ <goals>
37
+ <goal>start</goal>
38
+ </goals>
39
+ </execution>
40
+ <execution>
41
+ <id>post-test</id>
42
+ <phase>verify</phase>
43
+ <goals>
44
+ <goal>stop</goal>
45
+ </goals>
46
+ </execution>
47
+ </executions>
48
+ </plugin>
49
+ <!-- run ruby bundle build and install -->
22
50
  <plugin>
23
51
  <groupId>org.codehaus.mojo</groupId>
24
52
  <artifactId>exec-maven-plugin</artifactId>
@@ -1,7 +1,7 @@
1
1
  {
2
- "httpForward": {
3
- "host": "www.mock-server.com",
4
- "port": 80,
5
- "scheme": "HTTP"
6
- }
2
+ "httpForward": {
3
+ "host": "www.mock-server.com",
4
+ "port": 80,
5
+ "scheme": "HTTP"
6
+ }
7
7
  }
@@ -1,20 +1,20 @@
1
1
  {
2
- "httpResponse": {
3
- "statusCode": 401,
4
- "headers": [
5
- {
6
- "name": "Content-Type",
7
- "values": ["application/json; charset=utf-8"]
8
- },
9
- {
10
- "name": "Cache-Control",
11
- "values": ["public, max-age=86400"]
12
- }
13
- ],
14
- "body": "incorrect username and password combination",
15
- "delay": {
16
- "timeUnit": "SECONDS",
17
- "value": 1
18
- }
2
+ "httpResponse": {
3
+ "statusCode": 401,
4
+ "headers": [
5
+ {
6
+ "name": "Content-Type",
7
+ "values": ["application/json; charset=utf-8"]
8
+ },
9
+ {
10
+ "name": "Cache-Control",
11
+ "values": ["public, max-age=86400"]
12
+ }
13
+ ],
14
+ "body": "incorrect username and password combination",
15
+ "delay": {
16
+ "timeUnit": "SECONDS",
17
+ "value": 1
19
18
  }
19
+ }
20
20
  }
@@ -2,7 +2,7 @@
2
2
  "httpRequest": {
3
3
  "method": "POST",
4
4
  "path": "/login",
5
- "queryParameters": [
5
+ "queryStringParameters": [
6
6
  {
7
7
  "name": "returnUrl",
8
8
  "values": ["/account"]
@@ -11,7 +11,7 @@
11
11
  "cookies": [
12
12
  {
13
13
  "name": "sessionId",
14
- "values": ["2By8LOhBmaW5nZXJwcmludCIlMDAzMW"]
14
+ "value": "2By8LOhBmaW5nZXJwcmludCIlMDAzMW"
15
15
  }
16
16
  ],
17
17
  "body": {
@@ -2,7 +2,7 @@
2
2
  "httpRequest": {
3
3
  "method": "POST",
4
4
  "path": "/login",
5
- "queryParameters": [
5
+ "queryStringParameters": [
6
6
  {
7
7
  "values": [
8
8
  "/account"
@@ -12,10 +12,8 @@
12
12
  ],
13
13
  "cookies": [
14
14
  {
15
- "values": [
16
- "2By8LOhBmaW5nZXJwcmludCIlMDAzMW"
17
- ],
18
- "name": "sessionId"
15
+ "name": "sessionId",
16
+ "value": "2By8LOhBmaW5nZXJwcmludCIlMDAzMW"
19
17
  }
20
18
  ],
21
19
  "body": {
@@ -0,0 +1,22 @@
1
+ {
2
+ "method": "POST",
3
+ "path": "/login",
4
+ "queryStringParameters": [
5
+ {
6
+ "values": [
7
+ "/account"
8
+ ],
9
+ "name": "returnUrl"
10
+ }
11
+ ],
12
+ "cookies": [
13
+ {
14
+ "value": "2By8LOhBmaW5nZXJwcmludCIlMDAzMW",
15
+ "name": "sessionId"
16
+ }
17
+ ],
18
+ "body": {
19
+ "type": "STRING",
20
+ "value": "{\"username\":\"foo\",\"password\":\"bar\"}"
21
+ }
22
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "httpRequest": {
3
- "method": "POST",
4
- "path": "/login"
5
- }
2
+ "httpRequest": {
3
+ "method": "POST",
4
+ "path": "/login"
5
+ }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "times": {
3
- "remainingTimes": 1,
4
- "unlimited": "false"
5
- }
2
+ "times": {
3
+ "remainingTimes": 1,
4
+ "unlimited": "false"
5
+ }
6
6
  }
@@ -0,0 +1,82 @@
1
+ # encoding: UTF-8
2
+ require 'rspec'
3
+ require 'net/http'
4
+ require 'webmock/rspec'
5
+ require_relative '../../lib/mockserver-client'
6
+
7
+ RSpec.configure do |config|
8
+ include WebMock::API
9
+ include MockServer
10
+ include MockServer::UtilityMethods
11
+ include MockServer::Model::DSL
12
+
13
+ # Only accept expect syntax do not allow old should syntax
14
+ config.expect_with :rspec do |c|
15
+ c.syntax = :expect
16
+ end
17
+ end
18
+
19
+ describe MockServer::MockServerClient do
20
+
21
+ let(:client) { MockServer::MockServerClient.new('localhost', 1080) }
22
+
23
+ before do
24
+ # To suppress logging output to standard output, write to a temporary file
25
+ client.logger = LoggingFactory::DEFAULT_FACTORY.log('test', output: 'tmp.log', truncate: true)
26
+ end
27
+
28
+ def create_agent
29
+ uri = URI('http://api.nsa.gov:1337/agent')
30
+ http = Net::HTTP.new(uri.host, uri.port)
31
+ req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
32
+ req.body = { name: 'John Doe', role: 'agent' }.to_json
33
+ res = http.request(req)
34
+ puts "response #{res.body}"
35
+ rescue => e
36
+ puts "failed #{e}"
37
+ end
38
+
39
+ it 'setup complex expectation' do
40
+ WebMock.allow_net_connect!
41
+
42
+ # given
43
+ mock_expectation = expectation do |expectation|
44
+ expectation.request do |request|
45
+ request.method = 'POST'
46
+ request.path = '/somePath'
47
+ request.query_string_parameters << parameter('param', 'someQueryStringValue')
48
+ request.headers << header('Header', 'someHeaderValue')
49
+ request.cookies << cookie('cookie', 'someCookieValue')
50
+ request.body = exact('someBody')
51
+ end
52
+
53
+ expectation.response do |response|
54
+ response.status_code = 201
55
+ response.headers << header('header', 'someHeaderValue')
56
+ response.body = body('someBody')
57
+ response.delay = delay_by(:SECONDS, 1)
58
+ end
59
+
60
+ expectation.times = exactly(1)
61
+ end
62
+
63
+ # and
64
+ expect(client.register(mock_expectation).code).to eq(201)
65
+
66
+ # when
67
+ uri = URI('http://localhost:1080/somePath')
68
+ http = Net::HTTP.new(uri.host, uri.port)
69
+ req = Net::HTTP::Post.new('/somePath?param=someQueryStringValue')
70
+ req['Header'] = 'someHeaderValue'
71
+ req['Cookie'] = 'cookie=someCookieValue'
72
+ req.body = 'someBody'
73
+ res = http.request(req)
74
+
75
+ # then
76
+ expect(res.code).to eq('201')
77
+ expect(res.body).to eq('someBody')
78
+
79
+ WebMock.disable_net_connect!
80
+ end
81
+
82
+ end
@@ -5,7 +5,7 @@ describe MockServer::Model::DSL do
5
5
 
6
6
  it 'generates http requests correctly' do
7
7
  mock_request = http_request(:POST, '/login')
8
- mock_request.query_parameters = [parameter('returnUrl', '/account')]
8
+ mock_request.query_string_parameters = [parameter('returnUrl', '/account')]
9
9
  mock_request.cookies = [cookie('sessionId', '2By8LOhBmaW5nZXJwcmludCIlMDAzMW')]
10
10
  mock_request.body = exact("{username:'foo', password:'bar'}")
11
11
 
@@ -13,7 +13,7 @@ describe MockServer::Model::DSL do
13
13
 
14
14
  # Block style
15
15
  mock_request = request(:POST, '/login') do |request|
16
- request.query_parameters = [parameter('returnUrl', '/account')]
16
+ request.query_string_parameters = [parameter('returnUrl', '/account')]
17
17
  request.cookies = [cookie('sessionId', '2By8LOhBmaW5nZXJwcmludCIlMDAzMW')]
18
18
  request.body = exact("{username:'foo', password:'bar'}")
19
19
  end
@@ -12,10 +12,13 @@ describe MockServer::MockServerClient do
12
12
  client.logger = LoggingFactory::DEFAULT_FACTORY.log('test', output: 'tmp.log', truncate: true)
13
13
 
14
14
  # Stub requests
15
- stub_request(:put, /.+\/expectation/).with(body: register_expectation_json).to_return(status: 201)
16
- stub_request(:put, /.+\/clear/).with(body: search_request_json).to_return(status: 202)
17
- stub_request(:put, /.+\/reset/).to_return(status: 202)
18
- stub_request(:put, /.+\/retrieve/).with(body: search_request_json).to_return(body: '', status: 200)
15
+ stub_request(:put, /.+\/expectation/).with(body: register_expectation_json, headers: { 'Content-Type' => 'application/json' }).to_return(status: 201)
16
+ stub_request(:put, /.+\/clear/).with(body: search_request_json, headers: { 'Content-Type' => 'application/json' }).to_return(status: 202)
17
+ stub_request(:put, /.+\/reset/).with(headers: { 'Content-Type' => 'application/json' }).to_return(status: 202)
18
+ stub_request(:put, /.+\/retrieve/).with(body: search_request_json, headers: { 'Content-Type' => 'application/json' }).to_return(
19
+ body: '[]',
20
+ status: 200
21
+ )
19
22
  end
20
23
 
21
24
  it 'registers an expectation correctly' do
@@ -23,7 +26,7 @@ describe MockServer::MockServerClient do
23
26
  expectation.request do |request|
24
27
  request.method = 'POST'
25
28
  request.path = '/login'
26
- request.query_parameters << parameter('returnUrl', '/account')
29
+ request.query_string_parameters << parameter('returnUrl', '/account')
27
30
  request.cookies << cookie('sessionId', '2By8LOhBmaW5nZXJwcmludCIlMDAzMW')
28
31
  request.body = exact({ username: 'foo', password: 'bar' }.to_json)
29
32
  end
@@ -4,8 +4,8 @@ require_relative '../spec_helper'
4
4
  describe MockServer::ProxyClient do
5
5
 
6
6
  let(:client) { MockServer::ProxyClient.new('localhost', 8080) }
7
- let(:register_expectation) { FIXTURES.read('register_expectation.json') }
8
- let(:register_expectation_json) { register_expectation.to_json }
7
+ let(:retrieved_request) { FIXTURES.read('retrieved_request.json') }
8
+ let(:retrieved_request_json) { retrieved_request.to_json }
9
9
  let(:search_request_json) { FIXTURES.read('search_request.json').to_json }
10
10
 
11
11
  before do
@@ -14,7 +14,7 @@ describe MockServer::ProxyClient do
14
14
 
15
15
  # Stub requests
16
16
  stub_request(:put, /.+\/retrieve/).with(body: search_request_json).to_return(
17
- body: "[#{register_expectation_json}, #{register_expectation_json}]",
17
+ body: "[#{retrieved_request_json}, #{retrieved_request_json}]",
18
18
  status: 200
19
19
  )
20
20
  stub_request(:put, /.+\/dumpToLog$/).to_return(status: 202).once
@@ -24,7 +24,7 @@ describe MockServer::ProxyClient do
24
24
  it 'verifies requests correctly' do
25
25
  response = client.verify(request(:POST, '/login'), exactly(2))
26
26
  response = response.map { |mock| to_camelized_hash(mock.to_hash) }
27
- expect(response).to eq([register_expectation, register_expectation])
27
+ expect(response).to eq([retrieved_request, retrieved_request])
28
28
  end
29
29
 
30
30
  it 'raises an error when verification fails' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mockserver-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7.pre
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nayyara Samuel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-20 00:00:00.000000000 Z
12
+ date: 2015-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -31,42 +31,42 @@ dependencies:
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 10.3.2
34
+ version: '10.3'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: 10.3.2
41
+ version: '10.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: 3.0.0
48
+ version: '3.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 3.0.0
55
+ version: '3.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: simplecov
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: 0.8.2
62
+ version: '0.8'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 0.8.2
69
+ version: '0.8'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: 0.23.0
90
+ version: '0.23'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: 0.23.0
97
+ version: '0.23'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: hashie
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -115,42 +115,42 @@ dependencies:
115
115
  requirements:
116
116
  - - ~>
117
117
  - !ruby/object:Gem::Version
118
- version: 1.8.1
118
+ version: '1.8'
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.8.1
125
+ version: '1.8'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: activesupport
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ~>
131
131
  - !ruby/object:Gem::Version
132
- version: 4.2.0
132
+ version: '4.1'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ~>
138
138
  - !ruby/object:Gem::Version
139
- version: 4.2.0
139
+ version: '4.1'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: rest-client
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ~>
145
145
  - !ruby/object:Gem::Version
146
- version: 1.7.2
146
+ version: '1.7'
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - ~>
152
152
  - !ruby/object:Gem::Version
153
- version: 1.7.2
153
+ version: '1.7'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: logging_factory
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -171,28 +171,28 @@ dependencies:
171
171
  requirements:
172
172
  - - ~>
173
173
  - !ruby/object:Gem::Version
174
- version: 0.19.1
174
+ version: '0.19'
175
175
  type: :runtime
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
179
  - - ~>
180
180
  - !ruby/object:Gem::Version
181
- version: 0.19.1
181
+ version: '0.19'
182
182
  - !ruby/object:Gem::Dependency
183
183
  name: colorize
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - ~>
187
187
  - !ruby/object:Gem::Version
188
- version: 0.7.0
188
+ version: '0.7'
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - ~>
194
194
  - !ruby/object:Gem::Version
195
- version: 0.7.0
195
+ version: '0.7'
196
196
  description: A Ruby Client for MockServer that enables easy mocking of any system
197
197
  you integrate with via HTTP or HTTPS (i.e. services, web sites, etc)
198
198
  email:
@@ -205,7 +205,6 @@ extra_rdoc_files: []
205
205
  files:
206
206
  - .gitignore
207
207
  - .rubocop.yml
208
- - CHANGELOG.md
209
208
  - Gemfile
210
209
  - README.md
211
210
  - Rakefile
@@ -216,10 +215,12 @@ files:
216
215
  - lib/mockserver/mock_server_client.rb
217
216
  - lib/mockserver/model/array_of.rb
218
217
  - lib/mockserver/model/body.rb
218
+ - lib/mockserver/model/cookie.rb
219
219
  - lib/mockserver/model/delay.rb
220
220
  - lib/mockserver/model/enum.rb
221
221
  - lib/mockserver/model/expectation.rb
222
222
  - lib/mockserver/model/forward.rb
223
+ - lib/mockserver/model/header.rb
223
224
  - lib/mockserver/model/parameter.rb
224
225
  - lib/mockserver/model/request.rb
225
226
  - lib/mockserver/model/response.rb
@@ -233,8 +234,10 @@ files:
233
234
  - spec/fixtures/incorrect_login_response.json
234
235
  - spec/fixtures/post_login_request.json
235
236
  - spec/fixtures/register_expectation.json
237
+ - spec/fixtures/retrieved_request.json
236
238
  - spec/fixtures/search_request.json
237
239
  - spec/fixtures/times_once.json
240
+ - spec/integration/mock_client_integration_spec.rb
238
241
  - spec/mockserver/builder_spec.rb
239
242
  - spec/mockserver/mock_client_spec.rb
240
243
  - spec/mockserver/proxy_client_spec.rb
@@ -255,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
258
  requirements:
256
259
  - - ~>
257
260
  - !ruby/object:Gem::Version
258
- version: '2'
261
+ version: '2.0'
259
262
  requirements: []
260
263
  rubyforge_project:
261
264
  rubygems_version: 2.4.2
@@ -267,8 +270,10 @@ test_files:
267
270
  - spec/fixtures/incorrect_login_response.json
268
271
  - spec/fixtures/post_login_request.json
269
272
  - spec/fixtures/register_expectation.json
273
+ - spec/fixtures/retrieved_request.json
270
274
  - spec/fixtures/search_request.json
271
275
  - spec/fixtures/times_once.json
276
+ - spec/integration/mock_client_integration_spec.rb
272
277
  - spec/mockserver/builder_spec.rb
273
278
  - spec/mockserver/mock_client_spec.rb
274
279
  - spec/mockserver/proxy_client_spec.rb
@@ -1,15 +0,0 @@
1
- ### Version 0.0.1
2
- - Basic code.
3
-
4
- ### Version 0.0.2
5
- - CLI for this gem.
6
-
7
- ### Version 0.0.3
8
- - Changes responses returned from /retrieve and /verify to be Ruby models.
9
-
10
- ### Version 1.0.0
11
- - Merged ruby client fully into main MockServer build on master.
12
-
13
- ### Version 1.0.1
14
- - Fixes serialization bug with multi_json.
15
- - Changes dependency on activesupport from '~> 4' to '~> 3' to be less conservative.