so_stub_very_test 0.0.1 → 0.0.2
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/README.md +1 -1
- data/lib/so_stub_very_test/version.rb +1 -1
- data/lib/so_stub_very_test.rb +1 -1
- data/test/so_stub_very_test_test.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab2e09581e5a95d21c45bc5dcf362eba75dbbb7
|
4
|
+
data.tar.gz: 747f711125f10c91436421fc41178be84ee675bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52732f7b77f26b1e49afdc0089aafa5f3fa74766effb526c0618eab31870c66bbfc0362214e7174874612a7f2588e96fa4d8262536db0005a24863b218c47a17
|
7
|
+
data.tar.gz: f1b376fb7c675adc75e7f8248e502961601fe5208d4ae7df46625f6d577130bba380b4caa64af804887c98945749363c6b857330e211637f1ff4c80e60e5c27b
|
data/README.md
CHANGED
@@ -194,7 +194,7 @@ class TestDoges < Minitest::Test
|
|
194
194
|
|
195
195
|
def test_the_doge
|
196
196
|
stub_get "/doge", "hi from doge"
|
197
|
-
assert_equal "hi from doge", Excon.get(
|
197
|
+
assert_equal "hi from doge", Excon.get("http://www.example.com/doge").body
|
198
198
|
end
|
199
199
|
end
|
200
200
|
```
|
data/lib/so_stub_very_test.rb
CHANGED
@@ -9,7 +9,7 @@ module SoStubVeryTest
|
|
9
9
|
class NoPathGivenError < StandardError; end
|
10
10
|
|
11
11
|
def namespace(path, host = nil, &block)
|
12
|
-
if stub_paths.any? && stub_host != host
|
12
|
+
if stub_paths.any? && host && stub_host != host
|
13
13
|
raise MixedNamespacesError, "Namespaces can't be mixed (#{stub_host} and #{host == nil ? "nil" : host})"
|
14
14
|
end
|
15
15
|
|
@@ -100,6 +100,15 @@ class TestSoStubVeryTest < Minitest::Test
|
|
100
100
|
assert_equal Excon.stubs, [[{ path: /\A\/foo\/bar\/baz\Z/, method: :get }, { body: true }]]
|
101
101
|
end
|
102
102
|
|
103
|
+
def test_can_nest_default_host_namespace
|
104
|
+
# Will not raise MixedNamespacesError
|
105
|
+
SoStubVeryTest.default_host = "foo.example.com"
|
106
|
+
namespace "/foo" do
|
107
|
+
namespace "/bar" do
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
103
112
|
def test_can_use_no_path_when_in_namespace
|
104
113
|
namespace "/foo" do
|
105
114
|
stub_get true
|