adapter 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -5
- data/lib/adapter/defaults.rb +2 -3
- data/lib/adapter/version.rb +1 -1
- data/spec/adapter_spec.rb +13 -4
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -52,8 +52,4 @@ Adapters can be defined using a block, a module, or a module and a block. This a
|
|
52
52
|
* Make your feature addition or bug fix.
|
53
53
|
* Add tests for it. This is important so we don't break it in a future version unintentionally.
|
54
54
|
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine, but bump version in a commit by itself so we can ignore when we pull)
|
55
|
-
* Send us a pull request. Bonus points for topic branches.
|
56
|
-
|
57
|
-
== Copyright
|
58
|
-
|
59
|
-
Copyright (c) 2010 New Toy. See LICENSE for details.
|
55
|
+
* Send us a pull request. Bonus points for topic branches.
|
data/lib/adapter/defaults.rb
CHANGED
data/lib/adapter/version.rb
CHANGED
data/spec/adapter_spec.rb
CHANGED
@@ -195,12 +195,12 @@ describe Adapter do
|
|
195
195
|
end
|
196
196
|
|
197
197
|
describe "#fetch" do
|
198
|
-
it "returns value if found" do
|
198
|
+
it "returns value if key found" do
|
199
199
|
adapter.write('foo', 'bar')
|
200
200
|
adapter.fetch('foo', 'baz').should == 'bar'
|
201
201
|
end
|
202
202
|
|
203
|
-
it "returns value if not found" do
|
203
|
+
it "returns default value if not key found" do
|
204
204
|
adapter.fetch('foo', 'baz').should == 'baz'
|
205
205
|
end
|
206
206
|
|
@@ -213,11 +213,20 @@ describe Adapter do
|
|
213
213
|
end.should == 'bar'
|
214
214
|
end
|
215
215
|
|
216
|
-
it "returns
|
216
|
+
it "returns default if key not found" do
|
217
|
+
adapter.fetch('foo', 'default').should == 'default'
|
218
|
+
end
|
219
|
+
|
220
|
+
it "returns result of block if key not found" do
|
217
221
|
adapter.fetch('foo') do
|
218
222
|
'baz'
|
219
223
|
end.should == 'baz'
|
220
|
-
|
224
|
+
end
|
225
|
+
|
226
|
+
it "returns key if result of block writes key" do
|
227
|
+
adapter.fetch('foo', 'default') do
|
228
|
+
adapter.write('foo', 'write in block')
|
229
|
+
end.should == 'write in block'
|
221
230
|
end
|
222
231
|
|
223
232
|
it "yields key to block" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Nunemaker
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-01-
|
20
|
+
date: 2011-01-26 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|