httpspec_simple 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/lib/httpspec_simple/custom_matchers.rb +2 -2
- data/lib/httpspec_simple/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92e584f885b0245242709a44891cad5267dc21a3
|
4
|
+
data.tar.gz: 1570a382d33fca4616b46f542ddc178ce6f2729b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba779d59ac4afaa6ca22df2e48ca4d12dd6b975cf1501fa93792fb2079cc9848a403a7c3339d169cf967d79723643e014dcaa6e8342db6980789f058decd922a
|
7
|
+
data.tar.gz: e68340e72c87f173ecf6a250756933e2ddcbc6a80d5f72841ea53dd89dce346559e7166904fd3a8ae387d11fb292500c2e30e3e5929d134cf3cd2295a1ee88f0
|
data/README.md
CHANGED
@@ -30,12 +30,25 @@ Example passes if response is 200 ok
|
|
30
30
|
|
31
31
|
Example passes if response time is less than n seconds
|
32
32
|
|
33
|
+
### retrieve_body_including(string)
|
34
|
+
|
35
|
+
Example passes if response body include the passed string
|
36
|
+
|
37
|
+
### retrieve_body_matching(regexp)
|
38
|
+
|
39
|
+
Example passes if response body match the passed regexp
|
40
|
+
|
33
41
|
## helper method
|
34
42
|
|
35
|
-
### request(url)
|
43
|
+
### request(url, opt={})
|
36
44
|
|
37
45
|
Do request
|
38
46
|
|
47
|
+
option key | type | description
|
48
|
+
---------- | ------- | -----------
|
49
|
+
:retry | integer | when the response code is {40x,50x} or the timeout occurs, retry request the specific times, default value is 0
|
50
|
+
:timeout | integer | set to Net::HTTP's open_timeout and read_timeout
|
51
|
+
|
39
52
|
### base_url(prepend_string)
|
40
53
|
|
41
54
|
Prepend to the url string passed to following `request` method
|
@@ -15,7 +15,7 @@ module HttpspecSimple
|
|
15
15
|
|
16
16
|
RSpec::Matchers.define :respond_within do |expected|
|
17
17
|
match do |actual|
|
18
|
-
actual.response_time < expected
|
18
|
+
(@response_time = actual.response_time) < expected
|
19
19
|
end
|
20
20
|
|
21
21
|
failure_message_for_should do |actual|
|
@@ -27,7 +27,7 @@ module HttpspecSimple
|
|
27
27
|
end
|
28
28
|
|
29
29
|
define_method :description do
|
30
|
-
"respond within #{expected} seconds"
|
30
|
+
"respond within #{expected} seconds (got %.3f seconds)" % @response_time
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpspec_simple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koji NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|