api_matchers 0.5.1 → 0.6.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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -7
  3. data/History.markdown +10 -0
  4. data/README.markdown +37 -27
  5. data/api_matchers.gemspec +1 -1
  6. data/lib/api_matchers/core/rspec_matchers.rb +4 -0
  7. data/lib/api_matchers/http_status_code/be_forbidden.rb +21 -0
  8. data/lib/api_matchers/version.rb +1 -1
  9. data/lib/api_matchers.rb +1 -0
  10. data/spec/api_matchers/core/find_in_json_spec.rb +1 -1
  11. data/spec/api_matchers/core/setup_spec.rb +1 -1
  12. data/spec/api_matchers/headers/base_spec.rb +1 -1
  13. data/spec/api_matchers/headers/be_json_spec.rb +1 -1
  14. data/spec/api_matchers/headers/be_xml_spec.rb +1 -1
  15. data/spec/api_matchers/http_status_code/base_spec.rb +1 -1
  16. data/spec/api_matchers/http_status_code/be_bad_request_spec.rb +1 -1
  17. data/spec/api_matchers/http_status_code/be_forbidden_spec.rb +49 -0
  18. data/spec/api_matchers/http_status_code/be_internal_server_error_spec.rb +1 -1
  19. data/spec/api_matchers/http_status_code/be_not_found_spec.rb +2 -2
  20. data/spec/api_matchers/http_status_code/be_ok_spec.rb +1 -1
  21. data/spec/api_matchers/http_status_code/be_unauthorized_spec.rb +3 -3
  22. data/spec/api_matchers/http_status_code/be_unprocessable_entity_spec.rb +1 -1
  23. data/spec/api_matchers/http_status_code/create_resource_spec.rb +1 -1
  24. data/spec/api_matchers/response_body/base_spec.rb +1 -1
  25. data/spec/api_matchers/response_body/have_json_node_spec.rb +1 -1
  26. data/spec/api_matchers/response_body/have_json_spec.rb +1 -1
  27. data/spec/api_matchers/response_body/have_node_spec.rb +1 -1
  28. data/spec/api_matchers/response_body/have_xml_node_spec.rb +1 -1
  29. data/spec/spec_helper.rb +2 -0
  30. metadata +9 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8551de9e183566d4d82c9826172b6a181a6daf74
4
- data.tar.gz: d3caa8d552bb7f52708b80675b36a051b8f91464
3
+ metadata.gz: d882c54ce0bc594825cb011faec59a541294bb02
4
+ data.tar.gz: a0c3239ed282e344679a2a1db654196dc6cb2395
5
5
  SHA512:
6
- metadata.gz: 2d1b9058f255957ad59f53098e2287c26c09c5cd0bc1a76bf2aae1cb7e1f0acfdcf541d32dddf5c38450894aeb5c9018ac57a4a1cf6033b6b1ea0e4f7dfa9afc
7
- data.tar.gz: 133ca4527a7a9f2e166ae16826bef9ce6420d170e1b7f0bbbfe67ad1fb6562bb14a7f7c79a1f52f36e64b571bfb0262c7fd03887487621f02d6dbdcb50a0c740
6
+ metadata.gz: 815e34c991334a26b37a6e6616bde1ba1feec76faddbfc90e17f00009a7289ffa50db7c0ea01e86fb026cdf80f9519811b8ec5122e4aab37db5ba309a743733a
7
+ data.tar.gz: 29419d2f053a10c835ca4b3531f79f49e958bf7649bcd94530a298cebbc8156fc3e2d9f429fefcf2f0c5984af4969cb9faf0f2c65990f9709c2fc89a3dda5ddd
data/.travis.yml CHANGED
@@ -1,10 +1,12 @@
1
1
  language: ruby
2
+ script:
3
+ - bundle exec rspec spec
2
4
  rvm:
3
- - 1.9.3
4
- - 2.0
5
+ - rbx-2
6
+ - jruby-head
7
+ - ruby-head
8
+ - ruby
5
9
  - jruby
6
- before_install:
7
- - export DISPLAY=:99.0
8
- - sh -e /etc/init.d/xvfb start
9
- script:
10
- - bundle exec rspec
10
+ - 2.1.2
11
+ - 2.0.0
12
+ - 1.9.3
data/History.markdown CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.6.0
2
+
3
+ * Add be_forbidden matcher:
4
+
5
+ ```ruby
6
+ expect(response.status).to be_forbidden
7
+ ```
8
+
9
+ * Add RSpec 3 and RSpec 2 compatibility.
10
+
1
11
  ## 0.5.1
2
12
 
3
13
  * Fix #have_json matcher fail message. Fix issue #20
data/README.markdown CHANGED
@@ -15,6 +15,7 @@ Collection of RSpec matchers for your API.
15
15
  * `create_resource`
16
16
  * `be_a_bad_request`
17
17
  * `be_unauthorized`
18
+ * `be_forbidden`
18
19
  * `be_internal_server_error`
19
20
  * `be_not_found`
20
21
 
@@ -56,33 +57,33 @@ The have_node matcher parse the actual and see if have the expcted node with the
56
57
  You can verify if node exists:
57
58
 
58
59
  ```ruby
59
- '{ "transaction": { "id": 54, "status": "paid" } }'.should have_node(:transaction)
60
+ expect('{ "transaction": { "id": 54, "status": "paid" } }').to have_node(:transaction)
60
61
  ```
61
62
 
62
63
  Or if node exist with a value:
63
64
 
64
65
  ```ruby
65
- '{ "transaction": { "id": 54, "status": "paid" } }'.should have_node(:id).with(54)
66
+ expect('{ "transaction": { "id": 54, "status": "paid" } }').to have_node(:id).with(54)
66
67
  ```
67
68
 
68
69
  ```ruby
69
- '{ "error": "not_authorized" }'.should have_node(:error).with('not_authorized')
70
+ expect('{ "error": "not_authorized" }').to have_node(:error).with('not_authorized')
70
71
  ```
71
72
 
72
73
  ```ruby
73
- '{"parcels":1 }'.should have_node(:parcels).with(1)
74
+ expect('{"parcels":1 }').to have_node(:parcels).with(1)
74
75
  ```
75
76
 
76
77
  To see the json node and see if include a text, you can do this:
77
78
 
78
79
  ```ruby
79
- '{"error": "Transaction error: Name cant be blank"}'.should have_node(:error).including_text("Transaction error")
80
+ expect('{"error": "Transaction error: Name cant be blank"}').to have_node(:error).including_text("Transaction error")
80
81
  ```
81
82
 
82
83
  You can verify boolean values too:
83
84
 
84
85
  ```ruby
85
- '{"creditcard":true}'.should have_node(:creditcard).with(true)
86
+ expect('{"creditcard":true}').to have_node(:creditcard).with(true)
86
87
  ```
87
88
 
88
89
  ### HAVE NODE Matcher Configuration
@@ -96,25 +97,25 @@ end
96
97
  ```
97
98
 
98
99
  ```ruby
99
- '<transaction><id>200</id><status>paid</status></transaction>'.should have_node(:status)
100
+ expect('<transaction><id>200</id><status>paid</status></transaction>').to have_node(:status)
100
101
  ```
101
102
 
102
103
  Using the `with` method:
103
104
 
104
105
  ```ruby
105
- '<transaction><id>200</id><status>paid</status></transaction>'.should have_node(:status).with('paid')
106
+ expect('<transaction><id>200</id><status>paid</status></transaction>').to have_node(:status).with('paid')
106
107
  ```
107
108
 
108
109
  Or you can use the `have_xml_node` matcher:
109
110
 
110
111
  ```ruby
111
- "<error>Transaction error: Name can't be blank</error>".should have_xml_node(:error).with("Transaction error: Name can't be blank")
112
+ expect("<error>Transaction error: Name can't be blank</error>").to have_xml_node(:error).with("Transaction error: Name can't be blank")
112
113
  ```
113
114
 
114
115
  To see the xml node and see if include a text, you can do this:
115
116
 
116
117
  ```ruby
117
- "<error>Transaction error: Name can't be blank</error>".should have_xml_node(:error).including_text("Transaction error")
118
+ expect("<error>Transaction error: Name can't be blank</error>").to have_xml_node(:error).including_text("Transaction error")
118
119
  ```
119
120
 
120
121
  **If you work with xml and json in the same API, check the have_json_node and have_xml_node matchers.**
@@ -126,25 +127,25 @@ APIMatchers.setup do |config|
126
127
  config.response_body_method = :body
127
128
  end
128
129
 
129
- response.should have_node(:foo).with('bar')
130
+ expect(response).to have_node(:foo).with('bar')
130
131
  ```
131
132
 
132
133
  Instead of:
133
134
 
134
135
  ```ruby
135
- response.body.should have_node(:foo)
136
+ expect(response.body).to have_node(:foo)
136
137
  ```
137
138
 
138
139
  ### Have JSON Node Matcher
139
140
 
140
141
  ```ruby
141
- '{ "transaction": { "id": 54, "status": "paid" } }'.should have_json_node(:id).with(54)
142
+ expect('{ "transaction": { "id": 54, "status": "paid" } }').to have_json_node(:id).with(54)
142
143
  ```
143
144
 
144
145
  ### Have XML Node Matcher
145
146
 
146
147
  ```ruby
147
- "<product><name>gateway</name></product>".should have_xml_node(:name).with('gateway')
148
+ expect("<product><name>gateway</name></product>").to have_xml_node(:name).with('gateway')
148
149
  ```
149
150
 
150
151
  ### Have JSON Matcher
@@ -152,7 +153,7 @@ response.body.should have_node(:foo)
152
153
  Sometimes, you want to compare the entire JSON structure:
153
154
 
154
155
  ```ruby
155
- "['Foo', 'Bar', 'Baz']".should have_json(['Foo', 'Bar', 'Baz'])
156
+ expect("['Foo', 'Bar', 'Baz']").to have_json(['Foo', 'Bar', 'Baz'])
156
157
  ```
157
158
 
158
159
  ### Create Resource Matcher
@@ -160,7 +161,7 @@ Sometimes, you want to compare the entire JSON structure:
160
161
  This matchers see the HTTP STATUS CODE is equal to 201.
161
162
 
162
163
  ```ruby
163
- response.status.should create_resource
164
+ expect(response.status).to create_resource
164
165
  ```
165
166
 
166
167
  ### BAD REQUEST Matcher
@@ -168,8 +169,8 @@ response.status.should create_resource
168
169
  This BAD REQUEST is a matcher that see if the HTTP STATUS code is equal to 400.
169
170
 
170
171
  ```ruby
171
- response.status.should be_a_bad_request
172
- response.status.should be_bad_request
172
+ expect(response.status).to be_a_bad_request
173
+ expect(response.status).to be_bad_request
173
174
  ```
174
175
 
175
176
  ### UNAUTHORIZED Matcher
@@ -177,8 +178,16 @@ response.status.should be_bad_request
177
178
  This UNAUTHORIZED is a matcher that see if the HTTP STATUS code is equal to 401.
178
179
 
179
180
  ```ruby
180
- response.status.should be_unauthorized
181
- response.body.should have_node(:message).with('Invalid Credentials')
181
+ expect(response.status).to be_unauthorized
182
+ expect(response.body).to have_node(:message).with('Invalid Credentials')
183
+ ```
184
+
185
+ ### FORBIDDEN Matcher
186
+
187
+ This is a matcher to see if the HTTP STATUS code is equal to 403.
188
+
189
+ ```ruby
190
+ expect(response.status).to be_forbidden
182
191
  ```
183
192
 
184
193
  ### INTERNAL SERVER ERROR Matcher
@@ -186,8 +195,8 @@ response.body.should have_node(:message).with('Invalid Credentials')
186
195
  This INTERNAL SERVER Error is a matcher that see if the HTTP STATUS code is equal to 500.
187
196
 
188
197
  ```ruby
189
- response.status.should be_internal_server_error
190
- response.body.should have_node(:message).with('An Internal Error Occurs in our precious app. :S')
198
+ expect(response.status).to be_internal_server_error
199
+ expect(response.body).to have_node(:message).with('An Internal Error Occurs in our precious app. :S')
191
200
  ```
192
201
 
193
202
  ### HTTP STATUS CODE Configuration
@@ -203,7 +212,7 @@ end
203
212
  Then you can use without call the **#status** method:
204
213
 
205
214
  ```ruby
206
- response.should create_resource
215
+ expect(response).to create_resource
207
216
  ```
208
217
 
209
218
  This configurations affects this matchers:
@@ -213,6 +222,7 @@ This configurations affects this matchers:
213
222
  * `be_a_bad_request`
214
223
  * `be_internal_server_error`
215
224
  * `be_unauthorized`
225
+ * `be_forbidden`
216
226
  * `be_not_found`
217
227
 
218
228
  ### Be in XML Matcher
@@ -220,7 +230,7 @@ This configurations affects this matchers:
220
230
  This is a matcher that see if the content type is xml:
221
231
 
222
232
  ```ruby
223
- response.headers['Content-Type'].should be_in_xml
233
+ expect(response.headers['Content-Type']).to be_in_xml
224
234
  ```
225
235
 
226
236
  ### Be in JSON Matcher
@@ -228,7 +238,7 @@ response.headers['Content-Type'].should be_in_xml
228
238
  This is a matcher that see if the content type is in JSON:
229
239
 
230
240
  ```ruby
231
- response.headers['Content-Type'].should be_in_json
241
+ expect(response.headers['Content-Type']).to be_in_json
232
242
  ```
233
243
 
234
244
  ### Headers Configuration
@@ -245,8 +255,8 @@ end
245
255
  And then you will be able to use without call the **#headers** calling the **#['Content-Type']** method:
246
256
 
247
257
  ```ruby
248
- response.should be_in_json
249
- response.should be_in_xml
258
+ expect(response).to be_in_json
259
+ expect(response).to be_in_xml
250
260
  ```
251
261
 
252
262
  ### Acknowlegments
data/api_matchers.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = APIMatchers::VERSION
17
17
 
18
- gem.add_dependency 'rspec', '>= 2.14'
18
+ gem.add_dependency 'rspec', '~> 3.1'
19
19
  gem.add_dependency 'activesupport', '>= 3.2.5'
20
20
  gem.add_dependency 'nokogiri', '>= 1.5.2'
21
21
  end
@@ -18,6 +18,10 @@ module APIMatchers
18
18
  ::APIMatchers::HTTPStatusCode::BeUnauthorized.new(::APIMatchers::Core::Setup)
19
19
  end
20
20
 
21
+ def be_forbidden
22
+ ::APIMatchers::HTTPStatusCode::BeForbidden.new(::APIMatchers::Core::Setup)
23
+ end
24
+
21
25
  def be_ok
22
26
  ::APIMatchers::HTTPStatusCode::BeOk.new(::APIMatchers::Core::Setup)
23
27
  end
@@ -0,0 +1,21 @@
1
+ module APIMatchers
2
+ module HTTPStatusCode
3
+ class BeForbidden < Base
4
+ def expected_status_code
5
+ 403
6
+ end
7
+
8
+ def failure_message
9
+ %Q{expected that '#{@http_status_code}' to be Forbidden with the status '403'.}
10
+ end
11
+
12
+ def failure_message_when_negated
13
+ %Q{expected that '#{@http_status_code}' to NOT be Forbidden.}
14
+ end
15
+
16
+ # RSpec 2 compatibility:
17
+ alias_method :failure_message_for_should, :failure_message
18
+ alias_method :failure_message_for_should_not, :failure_message_when_negated
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module APIMatchers
2
- VERSION = "0.5.1"
2
+ VERSION = '0.6.0'
3
3
  end
data/lib/api_matchers.rb CHANGED
@@ -15,6 +15,7 @@ module APIMatchers
15
15
  autoload :BeUnauthorized, 'api_matchers/http_status_code/be_unauthorized'
16
16
  autoload :BeOk, 'api_matchers/http_status_code/be_ok'
17
17
  autoload :BeUnprocessableEntity, 'api_matchers/http_status_code/be_unprocessable_entity'
18
+ autoload :BeForbidden, 'api_matchers/http_status_code/be_forbidden'
18
19
  autoload :CreateResource, 'api_matchers/http_status_code/create_resource'
19
20
  end
20
21
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module APIMatchers::Core
4
- describe FindInJSON do
4
+ RSpec.describe FindInJSON do
5
5
  describe "#find" do
6
6
  context 'when node exists' do
7
7
  it "should return the value of the expected key" do
@@ -1,4 +1,4 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::Core::Setup do
3
+ RSpec.describe APIMatchers::Core::Setup do
4
4
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::Headers::Base do
3
+ RSpec.describe APIMatchers::Headers::Base do
4
4
  let(:setup) { OpenStruct.new }
5
5
  subject { APIMatchers::Headers::Base.new(setup) }
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::Headers::BeJSON do
3
+ RSpec.describe APIMatchers::Headers::BeJSON do
4
4
  describe "actual.to be_json" do
5
5
  it "should pass when the actual is json response" do
6
6
  expect("application/json; charset=utf-8").to be_json
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::Headers::BeXML do
3
+ RSpec.describe APIMatchers::Headers::BeXML do
4
4
  describe "actual.to be_xml" do
5
5
  it "should pass when the actual is json response" do
6
6
  expect("application/xml; charset=utf-8").to be_xml
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::Base do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::Base do
4
4
  let(:setup) { OpenStruct.new }
5
5
  subject { APIMatchers::HTTPStatusCode::Base.new(setup) }
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeBadRequest do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeBadRequest do
4
4
  describe "should be_bad_request" do
5
5
  it "should passes if the actual is equal to 400" do
6
6
  expect(400).to be_bad_request
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeForbidden do
4
+ describe "should be_forbidden" do
5
+ it "should passes if the actual is equal to 403" do
6
+ expect(403).to be_forbidden
7
+ end
8
+
9
+ it "should fails if the actual is not equal to 403" do
10
+ expect {
11
+ expect(400).to be_forbidden
12
+ }.to fail_with(%Q{expected that '400' to be Forbidden with the status '403'.})
13
+ end
14
+ end
15
+
16
+ describe "should_not be_forbidden" do
17
+ it "should pass if the actual is not equal to 403" do
18
+ expect(201).not_to be_forbidden
19
+ end
20
+
21
+ it "should fail if the actual is equal to 403" do
22
+ expect {
23
+ expect(403).not_to be_forbidden
24
+ }.to fail_with(%Q{expected that '403' to NOT be Forbidden.})
25
+ end
26
+ end
27
+
28
+ describe "with change configuration" do
29
+ before do
30
+ APIMatchers.setup { |config| config.http_status_method = :http_status }
31
+ end
32
+
33
+ after do
34
+ APIMatchers.setup { |config| config.http_status_method = nil }
35
+ end
36
+
37
+ it "should pass if the actual.http_status is equal to 403" do
38
+ response = OpenStruct.new(:http_status => 403)
39
+ expect(response).to be_forbidden
40
+ end
41
+
42
+ it "should fail if the actual.http_status is not equal to 403" do
43
+ response = OpenStruct.new(:http_status => 402)
44
+ expect {
45
+ expect(response).to be_forbidden
46
+ }.to fail_with(%Q{expected that '402' to be Forbidden with the status '403'.})
47
+ end
48
+ end
49
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeInternalServerError do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeInternalServerError do
4
4
  describe "should be_internal_server_error" do
5
5
  it "should passes if the actual is equal to 500" do
6
6
  expect(500).to be_internal_server_error
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeBadRequest do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeBadRequest do
4
4
  describe "should be_not_found" do
5
5
  it "should passes if the actual is equal to 404" do
6
6
  expect(404).to be_not_found
@@ -14,7 +14,7 @@ describe APIMatchers::HTTPStatusCode::BeBadRequest do
14
14
  end
15
15
 
16
16
  describe "should_not be_not_found" do
17
- it "should passes if the actual is not equal to 404" do
17
+ it "should pass if the actual is not equal to 404" do
18
18
  expect(401).not_to be_not_found
19
19
  end
20
20
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeOk do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeOk do
4
4
  describe "should be_ok" do
5
5
  it "should passes if the actual is equal to 200" do
6
6
  expect(200).to be_ok
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeUnauthorized do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeUnauthorized do
4
4
  describe "should be_unauthorized" do
5
5
  it "should passes if the actual is equal to 401" do
6
6
  expect(401).to be_unauthorized
@@ -14,11 +14,11 @@ describe APIMatchers::HTTPStatusCode::BeUnauthorized do
14
14
  end
15
15
 
16
16
  describe "should_not be_unauthorized" do
17
- it "should passes if the actual is not equal to 401" do
17
+ it "should pass if the actual is not equal to 401" do
18
18
  expect(201).not_to be_unauthorized
19
19
  end
20
20
 
21
- it "should fail if the actual is equal equal to 401" do
21
+ it "should fail if the actual is equal to 401" do
22
22
  expect {
23
23
  expect(401).not_to be_unauthorized
24
24
  }.to fail_with(%Q{expected that '401' to NOT be Unauthorized.})
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::BeUnprocessableEntity do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::BeUnprocessableEntity do
4
4
  describe "should be_unprocessable_entity" do
5
5
  it "should passes if the actual is equal to 422" do
6
6
  expect(422).to be_unprocessable_entity
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::HTTPStatusCode::CreateResource do
3
+ RSpec.describe APIMatchers::HTTPStatusCode::CreateResource do
4
4
  describe "should create_resource" do
5
5
  it "should passes if the actual is equal to 201" do
6
6
  expect(201).to create_resource
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::ResponseBody::Base do
3
+ RSpec.describe APIMatchers::ResponseBody::Base do
4
4
  let(:setup) { OpenStruct.new(:response_body_method => :body) }
5
5
  subject { APIMatchers::ResponseBody::Base.new(setup: setup, expected_node: :status) }
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::ResponseBody::HaveJsonNode do
3
+ RSpec.describe APIMatchers::ResponseBody::HaveJsonNode do
4
4
  describe "actual).to have_json_node" do
5
5
  context 'expected key and value in top level' do
6
6
  it "pass when the expected key exist" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::ResponseBody::HaveJson do
3
+ RSpec.describe APIMatchers::ResponseBody::HaveJson do
4
4
  describe "actual).to have_json" do
5
5
  context 'when pass' do
6
6
  it 'equal json' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::ResponseBody::HaveNode do
3
+ RSpec.describe APIMatchers::ResponseBody::HaveNode do
4
4
  describe "in json" do
5
5
  before do
6
6
  APIMatchers.setup { |config| config.have_node_matcher = :json }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe APIMatchers::ResponseBody::HaveXmlNode do
3
+ RSpec.describe APIMatchers::ResponseBody::HaveXmlNode do
4
4
  describe "actual).to have_xml_node" do
5
5
  context 'expected key and value in top level' do
6
6
  it "should pass when the expected key exist" do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,9 @@
1
+ require 'active_support'
1
2
  require 'api_matchers'
2
3
  require 'ostruct'
3
4
 
4
5
  RSpec.configure do |config|
6
+ config.disable_monkey_patching!
5
7
  config.include APIMatchers::RSpecMatchers
6
8
 
7
9
  def fail_with(message)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas D'Stefano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.14'
19
+ version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.14'
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +81,7 @@ files:
81
81
  - lib/api_matchers/headers/be_xml.rb
82
82
  - lib/api_matchers/http_status_code/base.rb
83
83
  - lib/api_matchers/http_status_code/be_bad_request.rb
84
+ - lib/api_matchers/http_status_code/be_forbidden.rb
84
85
  - lib/api_matchers/http_status_code/be_internal_server_error.rb
85
86
  - lib/api_matchers/http_status_code/be_not_found.rb
86
87
  - lib/api_matchers/http_status_code/be_ok.rb
@@ -100,6 +101,7 @@ files:
100
101
  - spec/api_matchers/headers/be_xml_spec.rb
101
102
  - spec/api_matchers/http_status_code/base_spec.rb
102
103
  - spec/api_matchers/http_status_code/be_bad_request_spec.rb
104
+ - spec/api_matchers/http_status_code/be_forbidden_spec.rb
103
105
  - spec/api_matchers/http_status_code/be_internal_server_error_spec.rb
104
106
  - spec/api_matchers/http_status_code/be_not_found_spec.rb
105
107
  - spec/api_matchers/http_status_code/be_ok_spec.rb
@@ -143,6 +145,7 @@ test_files:
143
145
  - spec/api_matchers/headers/be_xml_spec.rb
144
146
  - spec/api_matchers/http_status_code/base_spec.rb
145
147
  - spec/api_matchers/http_status_code/be_bad_request_spec.rb
148
+ - spec/api_matchers/http_status_code/be_forbidden_spec.rb
146
149
  - spec/api_matchers/http_status_code/be_internal_server_error_spec.rb
147
150
  - spec/api_matchers/http_status_code/be_not_found_spec.rb
148
151
  - spec/api_matchers/http_status_code/be_ok_spec.rb