so_stub_very_test 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d912b883c1d926912500fa80ce5f4e460ea01dc9
4
- data.tar.gz: d82a68fabdf2f56a50b878633dcd2949dab11852
3
+ metadata.gz: c98f18e778b94cc8312353b40d917eed8fa2a6c0
4
+ data.tar.gz: 73b845747f0b0f01ccf719035096e905683ea035
5
5
  SHA512:
6
- metadata.gz: ea777bbd8495e096e869297969cdcf534601e4a889b47764a3cdaa14704328b00ca28fe4fb531b6efe534b08a8349883af8cb5a6924c94abc2021fd96545c2cf
7
- data.tar.gz: ba463db45f01362989a81c6186c3d18d411ad8da0238c9496371f5117f92fe094bd890615c43932980ddfc3afc4bd1f9b68cdd7bd7a22556c6b0cad1eec2f262
6
+ metadata.gz: b81585a91b7c564420cd467b3d0a76bcf43daddd708b133ad8abb22d0ef728d7083422975d654e94cb6a739cd937920940a8829dd85a6e27056b44e73f88a4f0
7
+ data.tar.gz: 502736a9beab4a7a42289950bbbd6f4de9c09c3aed8bb354a8d2fb262f9a4c7828b6ca9f27be341e5f337fbeada97ad9f04b804bf3a3ed1084d0ad926b14b804
data/README.md CHANGED
@@ -57,7 +57,7 @@ stub_get "/foo" do
57
57
  body: "no meme here"
58
58
  }
59
59
  end
60
- # Equivalent: Excon.stub({ path: /\A\/foo\Z/, method: :post }, { body: "no meme here" })
60
+ # Equivalent: Excon.stub({ path: /\A\/foo\Z/, method: :get }, { body: "no meme here" })
61
61
  ```
62
62
 
63
63
  SoStubVeryTest will naïvely turn path parameters (any group of non-`/` preceded
@@ -132,6 +132,15 @@ SoStubVeryTest.defaults do
132
132
  end
133
133
  ```
134
134
 
135
+ ### Clearing the Stubs
136
+
137
+ You can clear any non-default stubs with this cool method:
138
+
139
+ ```ruby
140
+ SoStubVeryTest.clear_custom_stubs
141
+ # congratulations you have defeated the stubs
142
+ ```
143
+
135
144
  ## Testing with SoStubVeryTest
136
145
 
137
146
  ### For RSpec
@@ -185,7 +194,7 @@ class TestDoges < Minitest::Test
185
194
 
186
195
  def test_the_doge
187
196
  stub_get "/doge", "hi from doge"
188
- assert_equal "hi from doge", Excon.get({ path: "/doge" })
197
+ assert_equal "hi from doge", Excon.get({ path: "/doge" }).body
189
198
  end
190
199
  end
191
200
  ```
@@ -1,3 +1,3 @@
1
1
  module SoStubVeryTest
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.1"
3
3
  end
@@ -10,7 +10,7 @@ module SoStubVeryTest
10
10
 
11
11
  def namespace(path, host = nil, &block)
12
12
  if stub_paths.any? && stub_host != host
13
- raise MixedNamespacesError
13
+ raise MixedNamespacesError, "Namespaces can't be mixed (#{stub_host} and #{host == nil ? "nil" : host})"
14
14
  end
15
15
 
16
16
  stub_paths << path
@@ -134,13 +134,13 @@ module SoStubVeryTest
134
134
 
135
135
  def validate_path_given(path)
136
136
  if stub_paths.empty? && !path.is_a?(String)
137
- raise NoPathGivenError
137
+ raise NoPathGivenError, "Must provide a path to stub requests for"
138
138
  end
139
139
  end
140
140
 
141
141
  def validate_single_response(block, response)
142
142
  if block && response
143
- raise AmbiguousResponseError
143
+ raise AmbiguousResponseError, "Must provide only either a response object or a block"
144
144
  end
145
145
  end
146
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: so_stub_very_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Clem