lws 0.3.0.beta3 → 0.3.0.beta4
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.
- checksums.yaml +4 -4
- data/lib/lws/stubbing.rb +3 -2
- data/lib/lws/version.rb +1 -1
- data/test/fixtures/auth.yml +3 -0
- data/test/test_stubbing.rb +5 -0
- 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: 9cbec96d56d5893200965fd7106ea23e1c3608be
|
4
|
+
data.tar.gz: 614d396887f1f51a81a03cb945418208f9d65eff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 248ab515926c254eefcf56ecc48d930b47535bb7c6ca746086e7c6f843a3ff24afad4135ddddbd76842fa9fd935114a867b517bee1b223d6f53671094141156c
|
7
|
+
data.tar.gz: 3963e05e7373db9a7770941bbb1fb36865f66a63169602c7610060d40768efe9aee93ff25b8c0010ecc1b476b2ac7e4a7673ba280cd2bfc1a59c7e71e620f9e8
|
data/lib/lws/stubbing.rb
CHANGED
@@ -75,9 +75,10 @@ module LWS
|
|
75
75
|
# @param path [String] the path part of the request URI
|
76
76
|
# @param fixture_name [Symbol] the name of the fixture to use as stub
|
77
77
|
# response body
|
78
|
+
# @param http_status [Fixnum] the HTTP status code to use
|
78
79
|
# @raise if the fixture name could not be found for the given app name
|
79
80
|
# and path
|
80
|
-
def replace(method, app_name, path, fixture_name = :default)
|
81
|
+
def replace(method, app_name, path, fixture_name = :default, http_status = 200)
|
81
82
|
fixture = if fixture_name
|
82
83
|
@fixtures.dig(app_name.to_s, path, fixture_name.to_s)
|
83
84
|
else
|
@@ -100,7 +101,7 @@ module LWS
|
|
100
101
|
.to_return(body: MultiJson.dump(fixture), status: 204)
|
101
102
|
else
|
102
103
|
stub_request(method, full_uri)
|
103
|
-
.to_return(body: MultiJson.dump(fixture))
|
104
|
+
.to_return(body: MultiJson.dump(fixture), status: http_status)
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
data/lib/lws/version.rb
CHANGED
data/test/fixtures/auth.yml
CHANGED
data/test/test_stubbing.rb
CHANGED
@@ -29,6 +29,11 @@ class TestStubbing < MiniTest::Unit::TestCase
|
|
29
29
|
assert LWS::Auth::Token.find("test")
|
30
30
|
end
|
31
31
|
|
32
|
+
def test_working_stubbing_with_status
|
33
|
+
LWS.stubbing.replace(:get, :auth, "/tokens/does_not_exist", :default, 403)
|
34
|
+
assert_nil LWS::Auth::Token.find("does_not_exist")
|
35
|
+
end
|
36
|
+
|
32
37
|
def test_replace_stub
|
33
38
|
result = LWS.stubbing.replace(:get, :auth, "/accounts/1/apps", :generic)
|
34
39
|
assert result
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeftClick B.V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|