airborne 0.2.13 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.dependabot/config.yml +8 -0
- data/.github/dependabot.yml +8 -0
- data/.travis.yml +4 -3
- data/CHANGELOG.md +458 -0
- data/README.md +62 -4
- data/Rakefile +14 -0
- data/airborne.gemspec +7 -5
- data/lib/airborne/base.rb +14 -10
- data/lib/airborne/rest_client_requester.rb +30 -7
- data/lib/airborne.rb +3 -0
- data/spec/airborne/client_requester_spec.rb +171 -9
- data/spec/airborne/post_spec.rb +7 -0
- data/spec/airborne/put_spec.rb +19 -1
- metadata +53 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 42e0553b3d4f844a8eea2fc53ae62e82ab2fcc905701d6c928aa03e9830aaeab
|
4
|
+
data.tar.gz: 37a4f58bc0d3799a3a6e19e179c19fa591cea3467f0416ffd59cbb4ecf86b01f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357596499531fe608744f118867e507cc63e9eafb1b4cbbe2411675008439360b24b3672e034e342bc4c5b845304d3678720cf763a96e0ded7abbbdba5c2eade
|
7
|
+
data.tar.gz: b9e11980f6999456a2296afe61666a1e73a6eda9e3c3202d5fcb15eb074c3bda714983976f9ba2e50e6e6a632681dbfabd674cb16e029fd2914f85d717d04cb0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,458 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.3.4](https://github.com/brooklynDev/airborne/tree/v0.3.4) (2019-04-30)
|
4
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.3.3...v0.3.4)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Add a changelog [\#104](https://github.com/brooklynDev/airborne/issues/104)
|
9
|
+
- Changelog and semantic versioning [\#63](https://github.com/brooklynDev/airborne/issues/63)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- send payload with delete requests [\#154](https://github.com/brooklynDev/airborne/pull/154) ([mycargus](https://github.com/mycargus))
|
14
|
+
- automate changelog with rake task [\#153](https://github.com/brooklynDev/airborne/pull/153) ([mycargus](https://github.com/mycargus))
|
15
|
+
|
16
|
+
## [v0.3.3](https://github.com/brooklynDev/airborne/tree/v0.3.3) (2019-04-03)
|
17
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.3.2...v0.3.3)
|
18
|
+
|
19
|
+
**Closed issues:**
|
20
|
+
|
21
|
+
- How to set verify\_ssl =\> false [\#118](https://github.com/brooklynDev/airborne/issues/118)
|
22
|
+
|
23
|
+
**Merged pull requests:**
|
24
|
+
|
25
|
+
- create verify\_ssl config [\#152](https://github.com/brooklynDev/airborne/pull/152) ([mycargus](https://github.com/mycargus))
|
26
|
+
- Update webmock requirement from ~\> 0 to ~\> 3 [\#151](https://github.com/brooklynDev/airborne/pull/151) ([dependabot[bot]](https://github.com/apps/dependabot))
|
27
|
+
|
28
|
+
## [v0.3.2](https://github.com/brooklynDev/airborne/tree/v0.3.2) (2019-03-25)
|
29
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.3.1...v0.3.2)
|
30
|
+
|
31
|
+
**Merged pull requests:**
|
32
|
+
|
33
|
+
- pass block to RestClient method for better response handling [\#136](https://github.com/brooklynDev/airborne/pull/136) ([tabermike](https://github.com/tabermike))
|
34
|
+
|
35
|
+
## [v0.3.1](https://github.com/brooklynDev/airborne/tree/v0.3.1) (2019-03-21)
|
36
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.3.0...v0.3.1)
|
37
|
+
|
38
|
+
**Merged pull requests:**
|
39
|
+
|
40
|
+
- configure dependabot [\#150](https://github.com/brooklynDev/airborne/pull/150) ([mycargus](https://github.com/mycargus))
|
41
|
+
- Serialize to JSON when content type is set to JSON [\#142](https://github.com/brooklynDev/airborne/pull/142) ([rdalverny](https://github.com/rdalverny))
|
42
|
+
|
43
|
+
## [v0.3.0](https://github.com/brooklynDev/airborne/tree/v0.3.0) (2019-03-21)
|
44
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.13...v0.3.0)
|
45
|
+
|
46
|
+
**Merged pull requests:**
|
47
|
+
|
48
|
+
- upgrade runtime dependencies [\#149](https://github.com/brooklynDev/airborne/pull/149) ([mycargus](https://github.com/mycargus))
|
49
|
+
|
50
|
+
## [v0.2.13](https://github.com/brooklynDev/airborne/tree/v0.2.13) (2017-05-24)
|
51
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.12...v0.2.13)
|
52
|
+
|
53
|
+
**Closed issues:**
|
54
|
+
|
55
|
+
- : \( [\#135](https://github.com/brooklynDev/airborne/issues/135)
|
56
|
+
- Potential incompatibility with RSpec 3.5.4 [\#121](https://github.com/brooklynDev/airborne/issues/121)
|
57
|
+
|
58
|
+
**Merged pull requests:**
|
59
|
+
|
60
|
+
- Rspec 3.5 compatibility [\#137](https://github.com/brooklynDev/airborne/pull/137) ([axelson](https://github.com/axelson))
|
61
|
+
|
62
|
+
## [v0.2.12](https://github.com/brooklynDev/airborne/tree/v0.2.12) (2017-04-10)
|
63
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.11...v0.2.12)
|
64
|
+
|
65
|
+
**Merged pull requests:**
|
66
|
+
|
67
|
+
- date\_or\_null fix [\#123](https://github.com/brooklynDev/airborne/pull/123) ([tabermike](https://github.com/tabermike))
|
68
|
+
|
69
|
+
## [v0.2.11](https://github.com/brooklynDev/airborne/tree/v0.2.11) (2017-04-10)
|
70
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.10...v0.2.11)
|
71
|
+
|
72
|
+
## [v0.2.10](https://github.com/brooklynDev/airborne/tree/v0.2.10) (2017-04-10)
|
73
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.9...v0.2.10)
|
74
|
+
|
75
|
+
**Merged pull requests:**
|
76
|
+
|
77
|
+
- Replace Fixnum and Bignum with Integer [\#132](https://github.com/brooklynDev/airborne/pull/132) ([mcasper](https://github.com/mcasper))
|
78
|
+
- Fix Markdown syntax in Readme [\#130](https://github.com/brooklynDev/airborne/pull/130) ([dijonkitchen](https://github.com/dijonkitchen))
|
79
|
+
|
80
|
+
## [v0.2.9](https://github.com/brooklynDev/airborne/tree/v0.2.9) (2017-03-27)
|
81
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.8...v0.2.9)
|
82
|
+
|
83
|
+
**Closed issues:**
|
84
|
+
|
85
|
+
- Ruby 2.4 warnings [\#125](https://github.com/brooklynDev/airborne/issues/125)
|
86
|
+
|
87
|
+
**Merged pull requests:**
|
88
|
+
|
89
|
+
- Fix ruby 2.4 Fixnum deprecation warnings [\#127](https://github.com/brooklynDev/airborne/pull/127) ([iyedb](https://github.com/iyedb))
|
90
|
+
|
91
|
+
## [v0.2.8](https://github.com/brooklynDev/airborne/tree/v0.2.8) (2017-03-03)
|
92
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.7...v0.2.8)
|
93
|
+
|
94
|
+
**Closed issues:**
|
95
|
+
|
96
|
+
- Faraday Response support [\#120](https://github.com/brooklynDev/airborne/issues/120)
|
97
|
+
- GET from test environment [\#117](https://github.com/brooklynDev/airborne/issues/117)
|
98
|
+
- Airborne overrides too much of RSpec by default \(especially in the Rails context\) [\#115](https://github.com/brooklynDev/airborne/issues/115)
|
99
|
+
- \(Rails 5\) 0.2.6 causes bundle conflict due to activesupport \< 5.0 dependency [\#112](https://github.com/brooklynDev/airborne/issues/112)
|
100
|
+
|
101
|
+
**Merged pull requests:**
|
102
|
+
|
103
|
+
- Loosen gemspec, allow usage with rails 5 [\#122](https://github.com/brooklynDev/airborne/pull/122) ([rosskevin](https://github.com/rosskevin))
|
104
|
+
|
105
|
+
## [v0.2.7](https://github.com/brooklynDev/airborne/tree/v0.2.7) (2016-08-19)
|
106
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.6...v0.2.7)
|
107
|
+
|
108
|
+
**Closed issues:**
|
109
|
+
|
110
|
+
- NoMethodError: undefined method `\[\]' for nil:NilClass for POST on resource [\#110](https://github.com/brooklynDev/airborne/issues/110)
|
111
|
+
|
112
|
+
## [v0.2.6](https://github.com/brooklynDev/airborne/tree/v0.2.6) (2016-08-01)
|
113
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.5...v0.2.6)
|
114
|
+
|
115
|
+
**Closed issues:**
|
116
|
+
|
117
|
+
- How to test array as json root? [\#109](https://github.com/brooklynDev/airborne/issues/109)
|
118
|
+
- Permit comparison of complete objects [\#106](https://github.com/brooklynDev/airborne/issues/106)
|
119
|
+
- array\_of\_strings\_or\_null not working [\#92](https://github.com/brooklynDev/airborne/issues/92)
|
120
|
+
|
121
|
+
**Merged pull requests:**
|
122
|
+
|
123
|
+
- Upgrade version range for rest-client and test Ruby 2.3.1 [\#111](https://github.com/brooklynDev/airborne/pull/111) ([stefan-kolb](https://github.com/stefan-kolb))
|
124
|
+
- Update README.md [\#102](https://github.com/brooklynDev/airborne/pull/102) ([tit](https://github.com/tit))
|
125
|
+
|
126
|
+
## [v0.2.5](https://github.com/brooklynDev/airborne/tree/v0.2.5) (2016-04-12)
|
127
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.4...v0.2.5)
|
128
|
+
|
129
|
+
## [v0.2.4](https://github.com/brooklynDev/airborne/tree/v0.2.4) (2016-04-12)
|
130
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.3...v0.2.4)
|
131
|
+
|
132
|
+
## [v0.2.3](https://github.com/brooklynDev/airborne/tree/v0.2.3) (2016-02-09)
|
133
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.2...v0.2.3)
|
134
|
+
|
135
|
+
**Closed issues:**
|
136
|
+
|
137
|
+
- base\_url configuration option not working [\#87](https://github.com/brooklynDev/airborne/issues/87)
|
138
|
+
|
139
|
+
**Merged pull requests:**
|
140
|
+
|
141
|
+
- Fix Ariborne default content\_type override to :json [\#89](https://github.com/brooklynDev/airborne/pull/89) ([kevcha](https://github.com/kevcha))
|
142
|
+
|
143
|
+
## [v0.2.2](https://github.com/brooklynDev/airborne/tree/v0.2.2) (2015-12-16)
|
144
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.1...v0.2.2)
|
145
|
+
|
146
|
+
**Closed issues:**
|
147
|
+
|
148
|
+
- Expecting array responses [\#85](https://github.com/brooklynDev/airborne/issues/85)
|
149
|
+
- Upload file using post [\#84](https://github.com/brooklynDev/airborne/issues/84)
|
150
|
+
- Clear database before specific test [\#75](https://github.com/brooklynDev/airborne/issues/75)
|
151
|
+
- Why no exact match matcher, what am I overlooking? [\#65](https://github.com/brooklynDev/airborne/issues/65)
|
152
|
+
|
153
|
+
## [v0.2.1](https://github.com/brooklynDev/airborne/tree/v0.2.1) (2015-12-13)
|
154
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.2.0...v0.2.1)
|
155
|
+
|
156
|
+
**Closed issues:**
|
157
|
+
|
158
|
+
- breaking change in expect\_json [\#67](https://github.com/brooklynDev/airborne/issues/67)
|
159
|
+
|
160
|
+
## [v0.2.0](https://github.com/brooklynDev/airborne/tree/v0.2.0) (2015-12-12)
|
161
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.20...v0.2.0)
|
162
|
+
|
163
|
+
**Closed issues:**
|
164
|
+
|
165
|
+
- No params = {} parameter in GET request? [\#45](https://github.com/brooklynDev/airborne/issues/45)
|
166
|
+
|
167
|
+
**Merged pull requests:**
|
168
|
+
|
169
|
+
- add configurable strictness for `expect\_json` and `expect\_json\_types` [\#83](https://github.com/brooklynDev/airborne/pull/83) ([sethpollack](https://github.com/sethpollack))
|
170
|
+
- updated patch and added 2.2 [\#82](https://github.com/brooklynDev/airborne/pull/82) ([ferdinandrosario](https://github.com/ferdinandrosario))
|
171
|
+
|
172
|
+
## [v0.1.20](https://github.com/brooklynDev/airborne/tree/v0.1.20) (2015-09-24)
|
173
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.19...v0.1.20)
|
174
|
+
|
175
|
+
**Closed issues:**
|
176
|
+
|
177
|
+
- In case of multiple requests, expect\_json keeps checking with response of first request. [\#71](https://github.com/brooklynDev/airborne/issues/71)
|
178
|
+
|
179
|
+
**Merged pull requests:**
|
180
|
+
|
181
|
+
- Add DELETE functionality when options are passed in [\#77](https://github.com/brooklynDev/airborne/pull/77) ([dmhalejr](https://github.com/dmhalejr))
|
182
|
+
|
183
|
+
## [v0.1.19](https://github.com/brooklynDev/airborne/tree/v0.1.19) (2015-08-07)
|
184
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.18...v0.1.19)
|
185
|
+
|
186
|
+
## [v0.1.18](https://github.com/brooklynDev/airborne/tree/v0.1.18) (2015-08-07)
|
187
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.17...v0.1.18)
|
188
|
+
|
189
|
+
## [v0.1.17](https://github.com/brooklynDev/airborne/tree/v0.1.17) (2015-08-07)
|
190
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.16...v0.1.17)
|
191
|
+
|
192
|
+
**Closed issues:**
|
193
|
+
|
194
|
+
- Compatibility with rspec-rails [\#70](https://github.com/brooklynDev/airborne/issues/70)
|
195
|
+
- Can `subject` be called when one of the API methods is called? [\#47](https://github.com/brooklynDev/airborne/issues/47)
|
196
|
+
|
197
|
+
**Merged pull requests:**
|
198
|
+
|
199
|
+
- Allow expectations on consecutive requests to work [\#69](https://github.com/brooklynDev/airborne/pull/69) ([balvig](https://github.com/balvig))
|
200
|
+
|
201
|
+
## [v0.1.16](https://github.com/brooklynDev/airborne/tree/v0.1.16) (2015-07-06)
|
202
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.15...v0.1.16)
|
203
|
+
|
204
|
+
**Implemented enhancements:**
|
205
|
+
|
206
|
+
- Add :null to the json\_types mapper [\#61](https://github.com/brooklynDev/airborne/issues/61)
|
207
|
+
- better error messages when passing bad options to expect\_json\_types [\#59](https://github.com/brooklynDev/airborne/issues/59)
|
208
|
+
|
209
|
+
**Fixed bugs:**
|
210
|
+
|
211
|
+
- json body rails [\#58](https://github.com/brooklynDev/airborne/issues/58)
|
212
|
+
|
213
|
+
**Closed issues:**
|
214
|
+
|
215
|
+
- head :no\_content issue [\#57](https://github.com/brooklynDev/airborne/issues/57)
|
216
|
+
- How send POST request with form data? [\#56](https://github.com/brooklynDev/airborne/issues/56)
|
217
|
+
- Error on http://brooklyndev.github.io/airborne/ [\#54](https://github.com/brooklynDev/airborne/issues/54)
|
218
|
+
- How to provide forms parameters for POST? [\#46](https://github.com/brooklynDev/airborne/issues/46)
|
219
|
+
- Using Airborne with rails-cucumber [\#44](https://github.com/brooklynDev/airborne/issues/44)
|
220
|
+
- JSON::ParserError [\#43](https://github.com/brooklynDev/airborne/issues/43)
|
221
|
+
- ENHANCEMENT: Throw error if object called is not present within json\_body [\#42](https://github.com/brooklynDev/airborne/issues/42)
|
222
|
+
|
223
|
+
**Merged pull requests:**
|
224
|
+
|
225
|
+
- Remove duplicate word and newline in error message [\#60](https://github.com/brooklynDev/airborne/pull/60) ([alcesleo](https://github.com/alcesleo))
|
226
|
+
- Update README.md [\#55](https://github.com/brooklynDev/airborne/pull/55) ([tit](https://github.com/tit))
|
227
|
+
- Fix cherry-picking Active Support core extension [\#53](https://github.com/brooklynDev/airborne/pull/53) ([carhartl](https://github.com/carhartl))
|
228
|
+
- Fix expect\_json in case a property is a hash and keys differ [\#52](https://github.com/brooklynDev/airborne/pull/52) ([carhartl](https://github.com/carhartl))
|
229
|
+
- unneeded local var assignment [\#51](https://github.com/brooklynDev/airborne/pull/51) ([josephgrossberg](https://github.com/josephgrossberg))
|
230
|
+
- Update README.md [\#49](https://github.com/brooklynDev/airborne/pull/49) ([RodneyU215](https://github.com/RodneyU215))
|
231
|
+
- Fix headers not passing during rack-test request [\#48](https://github.com/brooklynDev/airborne/pull/48) ([mcordell](https://github.com/mcordell))
|
232
|
+
|
233
|
+
## [v0.1.15](https://github.com/brooklynDev/airborne/tree/v0.1.15) (2015-03-03)
|
234
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.14...v0.1.15)
|
235
|
+
|
236
|
+
**Closed issues:**
|
237
|
+
|
238
|
+
- upgrade rest-client dependency [\#41](https://github.com/brooklynDev/airborne/issues/41)
|
239
|
+
|
240
|
+
**Merged pull requests:**
|
241
|
+
|
242
|
+
- Feature: Allowing symbolized statuses to be passed to \#expect\_status matcher [\#38](https://github.com/brooklynDev/airborne/pull/38) ([jgwmaxwell](https://github.com/jgwmaxwell))
|
243
|
+
|
244
|
+
## [v0.1.14](https://github.com/brooklynDev/airborne/tree/v0.1.14) (2015-03-02)
|
245
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.13...v0.1.14)
|
246
|
+
|
247
|
+
## [v0.1.13](https://github.com/brooklynDev/airborne/tree/v0.1.13) (2015-03-01)
|
248
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.12...v0.1.13)
|
249
|
+
|
250
|
+
**Closed issues:**
|
251
|
+
|
252
|
+
- JSON::ParserError 757 on Post Success [\#39](https://github.com/brooklynDev/airborne/issues/39)
|
253
|
+
|
254
|
+
**Merged pull requests:**
|
255
|
+
|
256
|
+
- throw InvalidJsonError when accessing json\_body on invalid json request [\#40](https://github.com/brooklynDev/airborne/pull/40) ([sethpollack](https://github.com/sethpollack))
|
257
|
+
|
258
|
+
## [v0.1.12](https://github.com/brooklynDev/airborne/tree/v0.1.12) (2015-03-01)
|
259
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.11...v0.1.12)
|
260
|
+
|
261
|
+
**Merged pull requests:**
|
262
|
+
|
263
|
+
- Tests fail under RSpec 3.2 due to Airborne\#initialize needing to accept arguments [\#37](https://github.com/brooklynDev/airborne/pull/37) ([jgwmaxwell](https://github.com/jgwmaxwell))
|
264
|
+
|
265
|
+
## [v0.1.11](https://github.com/brooklynDev/airborne/tree/v0.1.11) (2015-01-30)
|
266
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.10...v0.1.11)
|
267
|
+
|
268
|
+
**Closed issues:**
|
269
|
+
|
270
|
+
- Loading multiple grape apps [\#35](https://github.com/brooklynDev/airborne/issues/35)
|
271
|
+
- Where is the code for `0.1.10`? [\#34](https://github.com/brooklynDev/airborne/issues/34)
|
272
|
+
- Expected ? to be array got Hash from JSON response [\#33](https://github.com/brooklynDev/airborne/issues/33)
|
273
|
+
|
274
|
+
**Merged pull requests:**
|
275
|
+
|
276
|
+
- Enable base header support when testing Rack applications [\#36](https://github.com/brooklynDev/airborne/pull/36) ([croeck](https://github.com/croeck))
|
277
|
+
|
278
|
+
## [v0.1.10](https://github.com/brooklynDev/airborne/tree/v0.1.10) (2015-01-08)
|
279
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.9...v0.1.10)
|
280
|
+
|
281
|
+
**Closed issues:**
|
282
|
+
|
283
|
+
- undefined method `keys' for nil:NilClass [\#31](https://github.com/brooklynDev/airborne/issues/31)
|
284
|
+
|
285
|
+
**Merged pull requests:**
|
286
|
+
|
287
|
+
- Fix indention in README.md [\#32](https://github.com/brooklynDev/airborne/pull/32) ([kenchan](https://github.com/kenchan))
|
288
|
+
|
289
|
+
## [v0.1.9](https://github.com/brooklynDev/airborne/tree/v0.1.9) (2015-01-05)
|
290
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.8...v0.1.9)
|
291
|
+
|
292
|
+
**Closed issues:**
|
293
|
+
|
294
|
+
- How do you get into an array inside an object? [\#30](https://github.com/brooklynDev/airborne/issues/30)
|
295
|
+
- ActiveSupport dependency [\#27](https://github.com/brooklynDev/airborne/issues/27)
|
296
|
+
|
297
|
+
## [v0.1.8](https://github.com/brooklynDev/airborne/tree/v0.1.8) (2014-12-10)
|
298
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.7...v0.1.8)
|
299
|
+
|
300
|
+
**Closed issues:**
|
301
|
+
|
302
|
+
- nil json\_body with data in body [\#28](https://github.com/brooklynDev/airborne/issues/28)
|
303
|
+
|
304
|
+
## [v0.1.7](https://github.com/brooklynDev/airborne/tree/v0.1.7) (2014-12-10)
|
305
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.6...v0.1.7)
|
306
|
+
|
307
|
+
## [v0.1.6](https://github.com/brooklynDev/airborne/tree/v0.1.6) (2014-12-10)
|
308
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.5...v0.1.6)
|
309
|
+
|
310
|
+
## [v0.1.5](https://github.com/brooklynDev/airborne/tree/v0.1.5) (2014-11-26)
|
311
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.4...v0.1.5)
|
312
|
+
|
313
|
+
**Merged pull requests:**
|
314
|
+
|
315
|
+
- Add Head method [\#26](https://github.com/brooklynDev/airborne/pull/26) ([jsvisa](https://github.com/jsvisa))
|
316
|
+
|
317
|
+
## [v0.1.4](https://github.com/brooklynDev/airborne/tree/v0.1.4) (2014-11-24)
|
318
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.3...v0.1.4)
|
319
|
+
|
320
|
+
**Closed issues:**
|
321
|
+
|
322
|
+
- Update CHANGELOG [\#23](https://github.com/brooklynDev/airborne/issues/23)
|
323
|
+
- Use of stabby lambda's is breaking jRuby support [\#21](https://github.com/brooklynDev/airborne/issues/21)
|
324
|
+
|
325
|
+
**Merged pull requests:**
|
326
|
+
|
327
|
+
- Rubygems shouldn't check in Gemfile.lock [\#24](https://github.com/brooklynDev/airborne/pull/24) ([svanhess](https://github.com/svanhess))
|
328
|
+
|
329
|
+
## [v0.1.3](https://github.com/brooklynDev/airborne/tree/v0.1.3) (2014-11-17)
|
330
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.2...v0.1.3)
|
331
|
+
|
332
|
+
## [v0.1.2](https://github.com/brooklynDev/airborne/tree/v0.1.2) (2014-11-16)
|
333
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.1...v0.1.2)
|
334
|
+
|
335
|
+
**Closed issues:**
|
336
|
+
|
337
|
+
- Handling of empty arrays [\#19](https://github.com/brooklynDev/airborne/issues/19)
|
338
|
+
- Feature Request: Add API for testing Array size [\#17](https://github.com/brooklynDev/airborne/issues/17)
|
339
|
+
- Problem with Dates? [\#16](https://github.com/brooklynDev/airborne/issues/16)
|
340
|
+
- Testing Arrays [\#15](https://github.com/brooklynDev/airborne/issues/15)
|
341
|
+
- helper methods for dates [\#14](https://github.com/brooklynDev/airborne/issues/14)
|
342
|
+
|
343
|
+
**Merged pull requests:**
|
344
|
+
|
345
|
+
- Fix problem with undefined status code method for Rack::MockResponse [\#20](https://github.com/brooklynDev/airborne/pull/20) ([grzesiek](https://github.com/grzesiek))
|
346
|
+
- Feature/matchers/expect json sizes [\#18](https://github.com/brooklynDev/airborne/pull/18) ([PikachuEXE](https://github.com/PikachuEXE))
|
347
|
+
|
348
|
+
## [v0.1.1](https://github.com/brooklynDev/airborne/tree/v0.1.1) (2014-10-20)
|
349
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.1.0...v0.1.1)
|
350
|
+
|
351
|
+
## [v0.1.0](https://github.com/brooklynDev/airborne/tree/v0.1.0) (2014-10-20)
|
352
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.23...v0.1.0)
|
353
|
+
|
354
|
+
**Closed issues:**
|
355
|
+
|
356
|
+
- Improper type identification by expect\_json\_types [\#12](https://github.com/brooklynDev/airborne/issues/12)
|
357
|
+
|
358
|
+
**Merged pull requests:**
|
359
|
+
|
360
|
+
- Fixes problems with configure blocks in README [\#13](https://github.com/brooklynDev/airborne/pull/13) ([cmckni3](https://github.com/cmckni3))
|
361
|
+
|
362
|
+
## [v0.0.23](https://github.com/brooklynDev/airborne/tree/v0.0.23) (2014-10-05)
|
363
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.22...v0.0.23)
|
364
|
+
|
365
|
+
**Merged pull requests:**
|
366
|
+
|
367
|
+
- Allow matching against a path [\#11](https://github.com/brooklynDev/airborne/pull/11) ([tikotzky](https://github.com/tikotzky))
|
368
|
+
|
369
|
+
## [v0.0.22](https://github.com/brooklynDev/airborne/tree/v0.0.22) (2014-09-29)
|
370
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.21...v0.0.22)
|
371
|
+
|
372
|
+
**Closed issues:**
|
373
|
+
|
374
|
+
- How to call "expect\_json\_keys" for multiple keys [\#10](https://github.com/brooklynDev/airborne/issues/10)
|
375
|
+
- array of json objects causes NoMethodError: in base.rb [\#8](https://github.com/brooklynDev/airborne/issues/8)
|
376
|
+
|
377
|
+
## [v0.0.21](https://github.com/brooklynDev/airborne/tree/v0.0.21) (2014-09-29)
|
378
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.20...v0.0.21)
|
379
|
+
|
380
|
+
## [v0.0.20](https://github.com/brooklynDev/airborne/tree/v0.0.20) (2014-09-22)
|
381
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.19...v0.0.20)
|
382
|
+
|
383
|
+
**Merged pull requests:**
|
384
|
+
|
385
|
+
- Requires only the necessary core\_ext from active\_support. [\#7](https://github.com/brooklynDev/airborne/pull/7) ([cvortmann](https://github.com/cvortmann))
|
386
|
+
|
387
|
+
## [v0.0.19](https://github.com/brooklynDev/airborne/tree/v0.0.19) (2014-09-19)
|
388
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.18...v0.0.19)
|
389
|
+
|
390
|
+
**Closed issues:**
|
391
|
+
|
392
|
+
- Enable Sourcegraph [\#4](https://github.com/brooklynDev/airborne/issues/4)
|
393
|
+
|
394
|
+
**Merged pull requests:**
|
395
|
+
|
396
|
+
- 100% Coveralls Code Coverage ;\) [\#6](https://github.com/brooklynDev/airborne/pull/6) ([tikotzky](https://github.com/tikotzky))
|
397
|
+
- Update README.md [\#5](https://github.com/brooklynDev/airborne/pull/5) ([wykhuh](https://github.com/wykhuh))
|
398
|
+
- Fix typo on README.md :\) [\#3](https://github.com/brooklynDev/airborne/pull/3) ([mparramont](https://github.com/mparramont))
|
399
|
+
|
400
|
+
## [v0.0.18](https://github.com/brooklynDev/airborne/tree/v0.0.18) (2014-09-18)
|
401
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.17...v0.0.18)
|
402
|
+
|
403
|
+
**Merged pull requests:**
|
404
|
+
|
405
|
+
- Add syntax highlighting to README [\#1](https://github.com/brooklynDev/airborne/pull/1) ([shekibobo](https://github.com/shekibobo))
|
406
|
+
|
407
|
+
## [v0.0.17](https://github.com/brooklynDev/airborne/tree/v0.0.17) (2014-09-17)
|
408
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.16...v0.0.17)
|
409
|
+
|
410
|
+
## [v0.0.16](https://github.com/brooklynDev/airborne/tree/v0.0.16) (2014-09-17)
|
411
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.15...v0.0.16)
|
412
|
+
|
413
|
+
## [v0.0.15](https://github.com/brooklynDev/airborne/tree/v0.0.15) (2014-09-17)
|
414
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.14...v0.0.15)
|
415
|
+
|
416
|
+
## [v0.0.14](https://github.com/brooklynDev/airborne/tree/v0.0.14) (2014-09-17)
|
417
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.13...v0.0.14)
|
418
|
+
|
419
|
+
## [v0.0.13](https://github.com/brooklynDev/airborne/tree/v0.0.13) (2014-09-17)
|
420
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.12...v0.0.13)
|
421
|
+
|
422
|
+
## [v0.0.12](https://github.com/brooklynDev/airborne/tree/v0.0.12) (2014-09-17)
|
423
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.11...v0.0.12)
|
424
|
+
|
425
|
+
## [v0.0.11](https://github.com/brooklynDev/airborne/tree/v0.0.11) (2014-09-17)
|
426
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.10...v0.0.11)
|
427
|
+
|
428
|
+
## [v0.0.10](https://github.com/brooklynDev/airborne/tree/v0.0.10) (2014-09-17)
|
429
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.9...v0.0.10)
|
430
|
+
|
431
|
+
## [v0.0.9](https://github.com/brooklynDev/airborne/tree/v0.0.9) (2014-09-17)
|
432
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.8...v0.0.9)
|
433
|
+
|
434
|
+
## [v0.0.8](https://github.com/brooklynDev/airborne/tree/v0.0.8) (2014-09-17)
|
435
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.7...v0.0.8)
|
436
|
+
|
437
|
+
## [v0.0.7](https://github.com/brooklynDev/airborne/tree/v0.0.7) (2014-09-17)
|
438
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.6...v0.0.7)
|
439
|
+
|
440
|
+
## [v0.0.6](https://github.com/brooklynDev/airborne/tree/v0.0.6) (2014-09-16)
|
441
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.5...v0.0.6)
|
442
|
+
|
443
|
+
## [v0.0.5](https://github.com/brooklynDev/airborne/tree/v0.0.5) (2014-09-16)
|
444
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.4...v0.0.5)
|
445
|
+
|
446
|
+
## [v0.0.4](https://github.com/brooklynDev/airborne/tree/v0.0.4) (2014-09-16)
|
447
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.3...v0.0.4)
|
448
|
+
|
449
|
+
## [v0.0.3](https://github.com/brooklynDev/airborne/tree/v0.0.3) (2014-09-16)
|
450
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.2...v0.0.3)
|
451
|
+
|
452
|
+
## [v0.0.2](https://github.com/brooklynDev/airborne/tree/v0.0.2) (2014-09-16)
|
453
|
+
[Full Changelog](https://github.com/brooklynDev/airborne/compare/v0.0.1...v0.0.2)
|
454
|
+
|
455
|
+
## [v0.0.1](https://github.com/brooklynDev/airborne/tree/v0.0.1) (2014-09-16)
|
456
|
+
|
457
|
+
|
458
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Airborne
|
1
|
+
# Airborne
|
2
2
|
|
3
3
|
[![airborne travis](http://img.shields.io/travis/brooklynDev/airborne.svg?branch=master&style=flat-square)](https://travis-ci.org/brooklynDev/airborne)
|
4
4
|
[![airborne coveralls](http://img.shields.io/coveralls/brooklynDev/airborne/master.svg?style=flat-square)](https://coveralls.io/r/brooklynDev/airborne?branch=master)
|
5
|
-
[![Code Climate](
|
5
|
+
[![Code Climate](https://api.codeclimate.com/v1/badges/00644ffcf94d5813aa80/maintainability)](https://codeclimate.com/github/brooklynDev/airborne/maintainability)
|
6
6
|
[![airborne gem version](http://img.shields.io/gem/v/airborne.svg?style=flat-square)](http://rubygems.org/gems/airborne)
|
7
7
|
[![airbore gem downloads](http://img.shields.io/gem/dt/airborne.svg?style=flat-square)](http://rubygems.org/gems/airborne)
|
8
8
|
[![airborne gem stable downloads](http://img.shields.io/gem/dv/airborne/stable.svg?style=flat-square)](http://rubygems.org/gems/airborne)
|
@@ -137,18 +137,76 @@ When calling any of the methods above, you can pass request headers to be used.
|
|
137
137
|
get 'http://example.com/api/v1/my_api', { 'x-auth-token' => 'my_token' }
|
138
138
|
```
|
139
139
|
|
140
|
-
For requests that require a body (`post`, `put`, `patch`) you can pass the body as
|
140
|
+
For requests that require a body (`post`, `put`, `patch`) you can pass the body as well:
|
141
141
|
|
142
142
|
```ruby
|
143
143
|
post 'http://example.com/api/v1/my_api', { :name => 'John Doe' }, { 'x-auth-token' => 'my_token' }
|
144
144
|
```
|
145
145
|
|
146
|
+
The body may be any JSON-serializable type, as long as you want to post `application/json` content type.
|
147
|
+
You may set a different content type and post a string body this way:
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
post 'http://example.com/api/v1/my_api', "Hello there!", { content_type: 'text/plain' }
|
151
|
+
```
|
152
|
+
|
146
153
|
For requests that require Query params you can pass a params hash into headers.
|
147
154
|
|
148
155
|
```ruby
|
149
156
|
post 'http://example.com/api/v1/my_api', { }, { 'params' => {'param_key' => 'param_value' } }
|
150
157
|
```
|
151
158
|
|
159
|
+
### (Not) Verifying SSL Certificates
|
160
|
+
|
161
|
+
SSL certificate verification is enabled by default (specifically, `OpenSSL::SSL::VERIFY_PEER`).
|
162
|
+
|
163
|
+
Carefully consider how you use this. It's not a solution for getting around a failed SSL cert verification; rather, it's intended for testing systems that don't have a legitimate SSL cert, such as a development or test environment.
|
164
|
+
|
165
|
+
You can override this behavior per request:
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
verify_ssl = false
|
169
|
+
post 'http://example.com/api/v1/my_api', "Hello there!", { content_type: 'text/plain' }, verify_ssl
|
170
|
+
```
|
171
|
+
|
172
|
+
or with a global Airborne configuration:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
Airborne.configure do |config|
|
176
|
+
config.verify_ssl = false # equivalent to OpenSSL::SSL::VERIFY_NONE
|
177
|
+
end
|
178
|
+
```
|
179
|
+
|
180
|
+
Note the per-request option always overrides the Airborne configuration:
|
181
|
+
|
182
|
+
```ruby
|
183
|
+
before do
|
184
|
+
Airborne.configuration.verify_ssl = false
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'will still verify the SSL certificate' do
|
188
|
+
verify_ssl = true
|
189
|
+
post 'http://example.com/api/v1/my_api', "Hello there!", { content_type: 'text/plain' }, verify_ssl
|
190
|
+
end
|
191
|
+
```
|
192
|
+
|
193
|
+
You can use the `verify_ssl` setting to override your global defaults in test blocks like this:
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
describe 'test something', verify_ssl: false do
|
197
|
+
end
|
198
|
+
```
|
199
|
+
|
200
|
+
OR
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
describe 'test something' do
|
204
|
+
Airborne.configuration.verify_ssl = false
|
205
|
+
end
|
206
|
+
```
|
207
|
+
|
208
|
+
This feature currently isn't supported when testing loaded Rack applications (see "Testing Rack Applications" below). If you need to set `verify_ssl: false`, then we recommend starting your Rack app server and sending the `airborne` HTTP requests as you would when testing any other service.
|
209
|
+
|
152
210
|
## Testing Rack Applications
|
153
211
|
|
154
212
|
If you have an existing Rack application like `sinatra` or `grape` you can run Airborne against your application and test without actually having a server running. To do that, just specify your rack application in your Airborne configuration:
|
@@ -231,7 +289,7 @@ it 'should allow nested paths' do
|
|
231
289
|
end
|
232
290
|
```
|
233
291
|
|
234
|
-
|
292
|
+
Alternatively, if we only want to test `coordinates` we can dot into just the `coordinates`:
|
235
293
|
|
236
294
|
```ruby
|
237
295
|
it 'should allow nested paths' do
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'github_changelog_generator/task'
|
2
|
+
|
3
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
4
|
+
raise(
|
5
|
+
ArgumentError,
|
6
|
+
'You need to export CHANGELOG_GITHUB_TOKEN first! You can generate one at: https://github.com/settings/tokens/new'
|
7
|
+
) if ENV['CHANGELOG_GITHUB_TOKEN'].nil?
|
8
|
+
|
9
|
+
config.project = 'airborne'
|
10
|
+
|
11
|
+
# change this to your github username if you plan to submit a PR with a new CHANGELOG.md
|
12
|
+
config.user = 'brooklynDev'
|
13
|
+
end
|
14
|
+
|
data/airborne.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'airborne'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.3.7'
|
6
6
|
s.date = Date.today.to_s
|
7
7
|
s.summary = 'RSpec driven API testing framework'
|
8
8
|
s.authors = ['Alex Friedman', 'Seth Pollack']
|
@@ -10,10 +10,12 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.require_paths = ['lib']
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
s.license = 'MIT'
|
13
|
-
s.add_runtime_dependency 'rspec', '~> 3.
|
14
|
-
s.add_runtime_dependency 'rest-client', '< 3.0', '>=
|
15
|
-
s.add_runtime_dependency 'rack-test', '
|
13
|
+
s.add_runtime_dependency 'rspec', '~> 3.8'
|
14
|
+
s.add_runtime_dependency 'rest-client', '< 3.0', '>= 2.0.2'
|
15
|
+
s.add_runtime_dependency 'rack-test', '< 2.0', '>= 1.1.0'
|
16
16
|
s.add_runtime_dependency 'rack'
|
17
17
|
s.add_runtime_dependency 'activesupport'
|
18
|
-
s.add_development_dependency 'webmock', '~>
|
18
|
+
s.add_development_dependency 'webmock', '~> 3'
|
19
|
+
s.add_development_dependency 'rake', '~> 12'
|
20
|
+
s.add_development_dependency 'github_changelog_generator', '~> 1.14'
|
19
21
|
end
|
data/lib/airborne/base.rb
CHANGED
@@ -29,24 +29,24 @@ module Airborne
|
|
29
29
|
RSpec.configuration
|
30
30
|
end
|
31
31
|
|
32
|
-
def get(url, headers = nil)
|
33
|
-
@response = make_request(:get, url, headers: headers)
|
32
|
+
def get(url, headers = nil, verify_ssl = base_verify_ssl)
|
33
|
+
@response = make_request(:get, url, headers: headers, verify_ssl: verify_ssl)
|
34
34
|
end
|
35
35
|
|
36
|
-
def post(url, post_body = nil, headers = nil)
|
37
|
-
@response = make_request(:post, url, body: post_body, headers: headers)
|
36
|
+
def post(url, post_body = nil, headers = nil, verify_ssl = base_verify_ssl)
|
37
|
+
@response = make_request(:post, url, body: post_body, headers: headers, verify_ssl: verify_ssl)
|
38
38
|
end
|
39
39
|
|
40
|
-
def patch(url, patch_body = nil, headers = nil)
|
41
|
-
@response = make_request(:patch, url, body: patch_body, headers: headers)
|
40
|
+
def patch(url, patch_body = nil, headers = nil, verify_ssl = base_verify_ssl)
|
41
|
+
@response = make_request(:patch, url, body: patch_body, headers: headers, verify_ssl: verify_ssl)
|
42
42
|
end
|
43
43
|
|
44
|
-
def put(url, put_body = nil, headers = nil)
|
45
|
-
@response = make_request(:put, url, body: put_body, headers: headers)
|
44
|
+
def put(url, put_body = nil, headers = nil, verify_ssl = base_verify_ssl)
|
45
|
+
@response = make_request(:put, url, body: put_body, headers: headers, verify_ssl: verify_ssl)
|
46
46
|
end
|
47
47
|
|
48
|
-
def delete(url, delete_body = nil, headers = nil)
|
49
|
-
@response = make_request(:delete, url, body: delete_body, headers: headers)
|
48
|
+
def delete(url, delete_body = nil, headers = nil, verify_ssl = base_verify_ssl)
|
49
|
+
@response = make_request(:delete, url, body: delete_body, headers: headers, verify_ssl: verify_ssl)
|
50
50
|
end
|
51
51
|
|
52
52
|
def head(url, headers = nil)
|
@@ -79,4 +79,8 @@ module Airborne
|
|
79
79
|
base = Airborne.configuration.base_url || ''
|
80
80
|
base + url
|
81
81
|
end
|
82
|
+
|
83
|
+
def base_verify_ssl
|
84
|
+
Airborne.configuration.verify_ssl || false
|
85
|
+
end
|
82
86
|
end
|
@@ -4,19 +4,31 @@ module Airborne
|
|
4
4
|
module RestClientRequester
|
5
5
|
def make_request(method, url, options = {})
|
6
6
|
headers = base_headers.merge(options[:headers] || {})
|
7
|
-
|
7
|
+
verify_ssl = options.fetch(:verify_ssl, true)
|
8
|
+
res = if method == :post || method == :patch || method == :put || method == :delete
|
8
9
|
begin
|
9
|
-
request_body = options[:body].nil? ? '' : options[:body]
|
10
|
-
request_body = request_body.to_json if
|
11
|
-
RestClient.
|
10
|
+
request_body = options[:body].nil? || is_empty(options[:body]) ? '' : options[:body]
|
11
|
+
request_body = request_body.to_json if is_json_request(headers) && !is_empty(request_body)
|
12
|
+
RestClient::Request.execute(
|
13
|
+
method: method,
|
14
|
+
url: get_url(url),
|
15
|
+
payload: request_body,
|
16
|
+
headers: headers,
|
17
|
+
verify_ssl: verify_ssl
|
18
|
+
) { |response, request, result| response }
|
12
19
|
rescue RestClient::Exception => e
|
13
|
-
e.response
|
20
|
+
e.response ? e.response : e.original_exception
|
14
21
|
end
|
15
22
|
else
|
16
23
|
begin
|
17
|
-
RestClient.
|
24
|
+
RestClient::Request.execute(
|
25
|
+
method: method,
|
26
|
+
url: get_url(url),
|
27
|
+
headers: headers,
|
28
|
+
verify_ssl: verify_ssl
|
29
|
+
) { |response, request, result| response }
|
18
30
|
rescue RestClient::Exception => e
|
19
|
-
e.response
|
31
|
+
e.response ? e.response : e.original_exception
|
20
32
|
end
|
21
33
|
end
|
22
34
|
res
|
@@ -24,6 +36,17 @@ module Airborne
|
|
24
36
|
|
25
37
|
private
|
26
38
|
|
39
|
+
def is_json_request(headers)
|
40
|
+
header = headers.fetch(:content_type)
|
41
|
+
header == :json || /application\/([a-zA-Z0-9\.\_\-]*\+?)json/ =~ header
|
42
|
+
end
|
43
|
+
|
44
|
+
def is_empty(body)
|
45
|
+
return body.empty? if body.respond_to?(:empty?)
|
46
|
+
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
27
50
|
def base_headers
|
28
51
|
{ content_type: :json }.merge(Airborne.configuration.headers || {})
|
29
52
|
end
|
data/lib/airborne.rb
CHANGED
@@ -15,11 +15,14 @@ RSpec.configure do |config|
|
|
15
15
|
config.add_setting :rack_app
|
16
16
|
config.add_setting :requester_type
|
17
17
|
config.add_setting :requester_module
|
18
|
+
config.add_setting :verify_ssl, default: true
|
18
19
|
config.before do |example|
|
19
20
|
config.match_expected = example.metadata[:match_expected].nil? ?
|
20
21
|
Airborne.configuration.match_expected_default? : example.metadata[:match_expected]
|
21
22
|
config.match_actual = example.metadata[:match_actual].nil? ?
|
22
23
|
Airborne.configuration.match_actual_default? : example.metadata[:match_actual]
|
24
|
+
config.verify_ssl = example.metadata[:verify_ssl].nil? ?
|
25
|
+
Airborne.configuration.verify_ssl? : example.metadata[:verify_ssl]
|
23
26
|
end
|
24
27
|
|
25
28
|
# Include last since it depends on the configuration already being added
|
@@ -2,27 +2,36 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'client requester' do
|
4
4
|
before do
|
5
|
-
allow(RestClient).to receive(:
|
5
|
+
allow(RestClient::Request).to receive(:execute)
|
6
6
|
RSpec::Mocks.space.proxy_for(self).remove_stub_if_present(:get)
|
7
7
|
end
|
8
8
|
|
9
9
|
after do
|
10
|
-
allow(RestClient).to receive(:
|
11
|
-
Airborne.configure { |config| config.headers =
|
10
|
+
allow(RestClient::Request).to receive(:execute).and_call_original
|
11
|
+
Airborne.configure { |config| config.headers = {} }
|
12
|
+
Airborne.configure { |config| config.verify_ssl = true }
|
12
13
|
end
|
13
14
|
|
14
15
|
it 'should set :content_type to :json by default' do
|
15
16
|
get '/foo'
|
16
17
|
|
17
|
-
expect(RestClient).to have_received(:
|
18
|
-
|
18
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
19
|
+
method: :get,
|
20
|
+
url: 'http://www.example.com/foo',
|
21
|
+
headers: { content_type: :json },
|
22
|
+
verify_ssl: true
|
23
|
+
)
|
19
24
|
end
|
20
25
|
|
21
26
|
it 'should override headers with option[:headers]' do
|
22
27
|
get '/foo', { content_type: 'application/x-www-form-urlencoded' }
|
23
28
|
|
24
|
-
expect(RestClient).to have_received(:
|
25
|
-
|
29
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
30
|
+
method: :get,
|
31
|
+
url: 'http://www.example.com/foo',
|
32
|
+
headers: { content_type: 'application/x-www-form-urlencoded' },
|
33
|
+
verify_ssl: true
|
34
|
+
)
|
26
35
|
end
|
27
36
|
|
28
37
|
it 'should override headers with airborne config headers' do
|
@@ -30,7 +39,160 @@ describe 'client requester' do
|
|
30
39
|
|
31
40
|
get '/foo'
|
32
41
|
|
33
|
-
expect(RestClient).to have_received(:
|
34
|
-
|
42
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
43
|
+
method: :get,
|
44
|
+
url: 'http://www.example.com/foo',
|
45
|
+
headers: { content_type: 'text/plain' },
|
46
|
+
verify_ssl: true
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should serialize body to json when :content_type is (default) :json' do
|
51
|
+
post '/foo', { test: 'serialized' }
|
52
|
+
|
53
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
54
|
+
method: :post,
|
55
|
+
url: 'http://www.example.com/foo',
|
56
|
+
payload: { test: 'serialized' }.to_json,
|
57
|
+
headers: { content_type: :json },
|
58
|
+
verify_ssl: true
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should serialize body to json when :content_type is any enhanced JSON content type' do
|
63
|
+
post '/foo', { test: 'serialized' }, { content_type: 'application/vnd.airborne.2+json' }
|
64
|
+
|
65
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
66
|
+
method: :post,
|
67
|
+
url: 'http://www.example.com/foo',
|
68
|
+
payload: { test: 'serialized' }.to_json,
|
69
|
+
headers: { content_type: 'application/vnd.airborne.2+json' },
|
70
|
+
verify_ssl: true
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should not serialize body to json when :content_type does not match JSON' do
|
75
|
+
post '/foo', { test: 'not serialized' }, { content_type: 'text/plain' }
|
76
|
+
|
77
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
78
|
+
method: :post,
|
79
|
+
url: 'http://www.example.com/foo',
|
80
|
+
payload: { test: 'not serialized' },
|
81
|
+
headers: { content_type: 'text/plain' },
|
82
|
+
verify_ssl: true
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should send payload with delete request' do
|
87
|
+
payload = { example: 'this is the payload' }
|
88
|
+
delete '/foo', payload
|
89
|
+
|
90
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
91
|
+
method: :delete,
|
92
|
+
url: 'http://www.example.com/foo',
|
93
|
+
payload: payload.to_json,
|
94
|
+
headers: { content_type: :json },
|
95
|
+
verify_ssl: true
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'verify_ssl' do
|
100
|
+
it 'should be true by default' do
|
101
|
+
get '/foo'
|
102
|
+
|
103
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
104
|
+
method: :get,
|
105
|
+
url: 'http://www.example.com/foo',
|
106
|
+
headers: { content_type: :json },
|
107
|
+
verify_ssl: true
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should be set by airborne config' do
|
112
|
+
Airborne.configure { |config| config.verify_ssl = false }
|
113
|
+
|
114
|
+
get '/foo'
|
115
|
+
|
116
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
117
|
+
method: :get,
|
118
|
+
url: 'http://www.example.com/foo',
|
119
|
+
headers: { content_type: :json },
|
120
|
+
verify_ssl: false
|
121
|
+
)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should be overriden with options[:verify_ssl]' do
|
125
|
+
get '/foo', nil, false
|
126
|
+
|
127
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
128
|
+
method: :get,
|
129
|
+
url: 'http://www.example.com/foo',
|
130
|
+
headers: { content_type: :json },
|
131
|
+
verify_ssl: false
|
132
|
+
)
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should override airborne config with options[:verify_ssl]' do
|
136
|
+
Airborne.configure { |config| config.verify_ssl = false }
|
137
|
+
|
138
|
+
get '/foo', nil, true
|
139
|
+
|
140
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
141
|
+
method: :get,
|
142
|
+
url: 'http://www.example.com/foo',
|
143
|
+
headers: { content_type: :json },
|
144
|
+
verify_ssl: true
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'should interpret airborne "config.verify_ssl = nil" as false' do
|
149
|
+
Airborne.configure { |config| config.verify_ssl = nil }
|
150
|
+
|
151
|
+
get '/foo'
|
152
|
+
|
153
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
154
|
+
method: :get,
|
155
|
+
url: 'http://www.example.com/foo',
|
156
|
+
headers: { content_type: :json },
|
157
|
+
verify_ssl: false
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'rspec metadata', verify_ssl: false do
|
162
|
+
it 'should override the base airborne config with the rspec metadata' do
|
163
|
+
get '/foo'
|
164
|
+
|
165
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
166
|
+
method: :get,
|
167
|
+
url: 'http://www.example.com/foo',
|
168
|
+
headers: { content_type: :json },
|
169
|
+
verify_ssl: false
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'should be overriden with options[:verify_ssl]' do
|
174
|
+
get '/foo', nil, true
|
175
|
+
|
176
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
177
|
+
method: :get,
|
178
|
+
url: 'http://www.example.com/foo',
|
179
|
+
headers: { content_type: :json },
|
180
|
+
verify_ssl: true
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'should be overriden by supplied airborne config' do
|
185
|
+
Airborne.configure { |config| config.verify_ssl = true }
|
186
|
+
|
187
|
+
get '/foo'
|
188
|
+
|
189
|
+
expect(RestClient::Request).to have_received(:execute).with(
|
190
|
+
method: :get,
|
191
|
+
url: 'http://www.example.com/foo',
|
192
|
+
headers: { content_type: :json },
|
193
|
+
verify_ssl: true
|
194
|
+
)
|
195
|
+
end
|
196
|
+
end
|
35
197
|
end
|
36
198
|
end
|
data/spec/airborne/post_spec.rb
CHANGED
@@ -14,4 +14,11 @@ describe 'post' do
|
|
14
14
|
post '/simple_post', 'hello', content_type: 'text/plain'
|
15
15
|
expect(WebMock).to have_requested(:post, url).with(body: 'hello', headers: { 'Content-Type' => 'text/plain' })
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'should allow testing on post requests with IO body' do
|
19
|
+
url = 'http://www.example.com/simple_post'
|
20
|
+
stub_request(:post, url)
|
21
|
+
post '/simple_post', StringIO.new('hello'), content_type: 'application/octet-stream'
|
22
|
+
expect(WebMock).to have_requested(:post, url).with(body: 'hello', headers: { 'Content-Type' => 'application/octet-stream' })
|
23
|
+
end
|
17
24
|
end
|
data/spec/airborne/put_spec.rb
CHANGED
@@ -1,9 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'put' do
|
4
|
-
it 'should allow testing on put requests' do
|
4
|
+
it 'should allow testing on put requests w/no body' do
|
5
|
+
mock_put('simple_put')
|
6
|
+
put '/simple_put'
|
7
|
+
expect_json_types(status: :string, someNumber: :int)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should allow testing on put requests w/empty body' do
|
5
11
|
mock_put('simple_put')
|
6
12
|
put '/simple_put', {}
|
7
13
|
expect_json_types(status: :string, someNumber: :int)
|
8
14
|
end
|
15
|
+
|
16
|
+
it 'should allow testing on put requests w/body' do
|
17
|
+
mock_put('simple_put')
|
18
|
+
put '/simple_put', {:key=>:value}
|
19
|
+
expect_json_types(status: :string, someNumber: :int)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should allow testing on put requests w/body, empty string' do
|
23
|
+
mock_put('simple_put')
|
24
|
+
put '/simple_put', ''
|
25
|
+
expect_json_types(status: :string, someNumber: :int)
|
26
|
+
end
|
9
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airborne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Friedman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -17,54 +17,54 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
20
|
+
version: '3.8'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
27
|
+
version: '3.8'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rest-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.0.2
|
32
35
|
- - "<"
|
33
36
|
- !ruby/object:Gem::Version
|
34
37
|
version: '3.0'
|
35
|
-
- - ">="
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.7.3
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.0.2
|
42
45
|
- - "<"
|
43
46
|
- !ruby/object:Gem::Version
|
44
47
|
version: '3.0'
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.7.3
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rack-test
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.6'
|
55
52
|
- - ">="
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
54
|
+
version: 1.1.0
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.0'
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- - "~>"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '0.6'
|
65
62
|
- - ">="
|
66
63
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
64
|
+
version: 1.1.0
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2.0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: rack
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,14 +99,42 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '3'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '3'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '12'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '12'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: github_changelog_generator
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '1.14'
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.14'
|
110
138
|
description:
|
111
139
|
email:
|
112
140
|
- a.friedman07@gmail.com
|
@@ -116,12 +144,16 @@ extensions: []
|
|
116
144
|
extra_rdoc_files: []
|
117
145
|
files:
|
118
146
|
- ".coveralls.yml"
|
147
|
+
- ".dependabot/config.yml"
|
148
|
+
- ".github/dependabot.yml"
|
119
149
|
- ".gitignore"
|
120
150
|
- ".rspec"
|
121
151
|
- ".travis.yml"
|
152
|
+
- CHANGELOG.md
|
122
153
|
- Gemfile
|
123
154
|
- LICENSE
|
124
155
|
- README.md
|
156
|
+
- Rakefile
|
125
157
|
- airborne.gemspec
|
126
158
|
- lib/airborne.rb
|
127
159
|
- lib/airborne/base.rb
|
@@ -199,8 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
231
|
- !ruby/object:Gem::Version
|
200
232
|
version: '0'
|
201
233
|
requirements: []
|
202
|
-
|
203
|
-
rubygems_version: 2.4.8
|
234
|
+
rubygems_version: 3.0.3
|
204
235
|
signing_key:
|
205
236
|
specification_version: 4
|
206
237
|
summary: RSpec driven API testing framework
|