webstub 1.0 → 1.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: 37e56234c1c4c8d97d42419be40c43f66fd225fe
4
- data.tar.gz: 2c31c16fee03426ce3b2b2c12e40517da4a9f8f2
3
+ metadata.gz: f8a0647b249466d2189e9ebf25a250591112b85b
4
+ data.tar.gz: 919be82dac97c1de010be6ec29d29272991c1a8e
5
5
  SHA512:
6
- metadata.gz: 1ce84e80cef83a0a0cd1dfdfffc8c1fcdcf93e6a1e375bfd3a67ce80138be6b9ca2c6a04f15b28784d4df5b54b2bfa30f10d727085b5c36b46227a8e9221bb94
7
- data.tar.gz: fa376e32a5774b2afbf70e11fe2ef11ad46b5ec32c34e9a6a64b5976fe704f555a411aec44b542884a1e76e4b976d2226dd809474c58474dd294f112d9213d40
6
+ metadata.gz: ec623ef6875c97b66c376786436be175110e7dad8f5294d6756edbda3f6fabf1fe71d916f4aaa1a23730642072258d45728f175b221930c30299e65badb20145
7
+ data.tar.gz: 0a109dab7b355c1d46ef2d288d6f024ef6a6af7d433ce0ec0eae1c11f16b051f2181dab6deb879b33c7aee10d5138fe2cea52a4654faa2c63a9f0f07eac3aa58
data/README.md CHANGED
@@ -5,7 +5,7 @@ What if [WebMock](https://github.com/bblimke/webmock) and [NSURLProtocol](https:
5
5
 
6
6
  Features
7
7
  ------------
8
- * Supports most any HTTP library that is built on NSURLConnection
8
+ * Supports most any HTTP library that is built on NSURLConnection / NSURLSession
9
9
  * Request matching based upon HTTP method, URI, and body
10
10
  * Optionally, disable real network access
11
11
  * Familiar, delicious syntax
@@ -149,6 +149,10 @@ describe Elevate::HTTP do
149
149
  end
150
150
  ```
151
151
 
152
+ Caveats
153
+ ---------
154
+ While WebStub supports `NSURLSession`, it does not support background sessions, as they don't allow the use of custom `NSURLProtocol` classes.
155
+
152
156
  TODO
153
157
  ---------
154
158
  * Handle query params similarly to form data
@@ -3,11 +3,13 @@ if Kernel.const_defined?(:NSURLSessionConfiguration)
3
3
  class << self
4
4
  alias_method :originalDefaultSessionConfiguration, :defaultSessionConfiguration
5
5
 
6
- def self.defaultSessionConfiguration
6
+ def defaultSessionConfiguration
7
7
  config = originalDefaultSessionConfiguration
8
8
 
9
- unless config.include?(WebStub::Protocol)
10
- config.protocolClasses << WebStub::Protocol
9
+ protocols = config.protocolClasses || []
10
+ unless protocols.include?(WebStub::Protocol)
11
+ protocols << WebStub::Protocol
12
+ config.protocolClasses = protocols
11
13
  end
12
14
 
13
15
  config
@@ -15,11 +17,13 @@ if Kernel.const_defined?(:NSURLSessionConfiguration)
15
17
 
16
18
  alias_method :originalEphemeralSessionConfiguration, :ephemeralSessionConfiguration
17
19
 
18
- def self.ephemeralSessionConfiguration
20
+ def ephemeralSessionConfiguration
19
21
  config = originalEphemeralSessionConfiguration
20
22
 
21
- unless config.include?(WebStub::Protocol)
22
- config.protocolClasses << WebStub::Protocol
23
+ protocols = config.protocolClasses || []
24
+ unless protocols.include?(WebStub::Protocol)
25
+ protocols << WebStub::Protocol
26
+ config.protocolClasses = protocols
23
27
  end
24
28
 
25
29
  config
@@ -1,3 +1,3 @@
1
1
  module WebStub
2
- VERSION = "1.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webstub
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake