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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd9b57026c373eec38df4b746c643dad33a72b24
4
- data.tar.gz: 51c458c026bf0124bc4f96b9c10314ddf95c8a87
3
+ metadata.gz: 9cbec96d56d5893200965fd7106ea23e1c3608be
4
+ data.tar.gz: 614d396887f1f51a81a03cb945418208f9d65eff
5
5
  SHA512:
6
- metadata.gz: f8e4f3e34688a00da22cfe01c86c31d09af98050345bd132ff5e354e895501a9f1f945a669ba54215597cf44cf10ed534b95ee3daee49471b94b215ff804c2a7
7
- data.tar.gz: ab76f33ee799fbe4edc200239dd809cd9a0ac2bfd442462d4cb04ace380b67187c02ba4aa8a027a24d088b95853b1704bb1148c559bbe52c77d0754f317e6d46
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
@@ -12,6 +12,6 @@ module LWS
12
12
 
13
13
  # The LWS library version.
14
14
  # @note This is not the API version!
15
- VERSION = '0.3.0.beta3'
15
+ VERSION = '0.3.0.beta4'
16
16
 
17
17
  end
@@ -15,6 +15,9 @@ auth:
15
15
  device_id: 1
16
16
  user_id: null
17
17
 
18
+ /tokens/does_not_exist:
19
+ default: {}
20
+
18
21
  /tokens:
19
22
  default:
20
23
  - *token_test
@@ -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.beta3
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-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday_middleware