adapter 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d0c01bd88fd4bcd672603bb7df4a4e23ae9f3777
4
+ data.tar.gz: f6bb5736764bcba5577dcf7912a6bcfa4967cad4
5
+ SHA512:
6
+ metadata.gz: 4326c49789ec3ea6add83a876edd86a5f1bba155d719c504954a26ec4c6cf10b212d854683b96ff41971483d54eeaf62ac7e749dc18133f197b4be9cd0a0505a
7
+ data.tar.gz: cd4fa741e779f803f2a1dec43354117a0a2ed2222367b6e1522f19de2d50dd7b3f796ad993673eb5920759b6d8f1ee53da4c3671e2ecfefff7c3a0948b704561
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - ree
5
3
  - 1.9.3
6
- notifications:
7
- email: false
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
8
7
  bundler_args: --without guard
8
+ before_install: gem install bundler
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  gem 'rake'
@@ -11,5 +11,5 @@ group(:guard) do
11
11
  end
12
12
 
13
13
  group(:test) do
14
- gem 'rspec'
14
+ gem 'rspec', '~> 3.4.0'
15
15
  end
@@ -1,6 +1,6 @@
1
1
  shared_examples_for "an adapter" do
2
2
  it "can read the client" do
3
- adapter.client.should == client
3
+ expect(adapter.client).to eq(client)
4
4
  end
5
5
 
6
6
  let(:key) { 'key' }
@@ -24,14 +24,14 @@ shared_examples_for "an adapter" do
24
24
 
25
25
  describe "#read" do
26
26
  it "returns nil if key not available" do
27
- adapter.read(key).should be_nil
27
+ expect(adapter.read(key)).to be_nil
28
28
  end
29
29
 
30
30
  it "returns attributes if key available" do
31
31
  adapter.write(key, attributes)
32
32
  result = adapter.read(key)
33
33
  attributes.each do |column, value|
34
- result[column].should eq(value)
34
+ expect(result[column]).to eq(value)
35
35
  end
36
36
  end
37
37
 
@@ -52,11 +52,11 @@ shared_examples_for "an adapter" do
52
52
  result = adapter.read_multiple([key, key2])
53
53
 
54
54
  attributes.each do |column, value|
55
- result[key][column].should eq(value)
55
+ expect(result[key][column]).to eq(value)
56
56
  end
57
57
 
58
58
  attributes2.each do |column, value|
59
- result[key2][column].should eq(value)
59
+ expect(result[key2][column]).to eq(value)
60
60
  end
61
61
  end
62
62
 
@@ -65,14 +65,14 @@ shared_examples_for "an adapter" do
65
65
  result = adapter.read_multiple([key, key2, unavailable_key])
66
66
 
67
67
  attributes.each do |column, value|
68
- result[key][column].should eq(value)
68
+ expect(result[key][column]).to eq(value)
69
69
  end
70
70
 
71
71
  attributes2.each do |column, value|
72
- result[key2][column].should eq(value)
72
+ expect(result[key2][column]).to eq(value)
73
73
  end
74
74
 
75
- result[unavailable_key].should be_nil
75
+ expect(result[unavailable_key]).to be_nil
76
76
  end
77
77
  end
78
78
 
@@ -86,11 +86,11 @@ shared_examples_for "an adapter" do
86
86
  describe "#key?" do
87
87
  it "returns true if key available" do
88
88
  adapter.write(key, attributes)
89
- adapter.key?(key).should be_true
89
+ expect(adapter.key?(key)).to be(true)
90
90
  end
91
91
 
92
92
  it "returns false if key not available" do
93
- adapter.key?(key).should be_false
93
+ expect(adapter.key?(key)).to be(false)
94
94
  end
95
95
 
96
96
  it "accepts options" do
@@ -104,13 +104,13 @@ shared_examples_for "an adapter" do
104
104
  context "with key not available" do
105
105
  context "with default attributes" do
106
106
  it "returns default" do
107
- adapter.fetch(key, {}).should eq({})
107
+ expect(adapter.fetch(key, {})).to eq({})
108
108
  end
109
109
  end
110
110
 
111
111
  context "with default block" do
112
112
  it "returns value of yielded block" do
113
- adapter.fetch(key) { |k| {} }.should eq({})
113
+ expect(adapter.fetch(key) { |k| {} }).to eq({})
114
114
  end
115
115
  end
116
116
  end
@@ -121,7 +121,7 @@ shared_examples_for "an adapter" do
121
121
  adapter.write(key, attributes2)
122
122
  result = adapter.fetch(key, attributes)
123
123
  attributes2.each do |column, value|
124
- result[column].should eq(value)
124
+ expect(result[column]).to eq(value)
125
125
  end
126
126
  end
127
127
  end
@@ -131,7 +131,7 @@ shared_examples_for "an adapter" do
131
131
  adapter.write(key, attributes)
132
132
  unaltered = 'unaltered'
133
133
  adapter.fetch(key) { unaltered = 'altered' }
134
- unaltered.should eq('unaltered')
134
+ expect(unaltered).to eq('unaltered')
135
135
  end
136
136
  end
137
137
  end
@@ -148,7 +148,7 @@ shared_examples_for "an adapter" do
148
148
  adapter.write(key, attributes)
149
149
  result = adapter.read(key)
150
150
  attributes.each do |column, value|
151
- result[column].should eq(value)
151
+ expect(result[column]).to eq(value)
152
152
  end
153
153
  end
154
154
 
@@ -163,17 +163,17 @@ shared_examples_for "an adapter" do
163
163
  context "when key available" do
164
164
  it "removes key" do
165
165
  adapter.write(key, attributes)
166
- adapter.key?(key).should be_true
166
+ expect(adapter.key?(key)).to be(true)
167
167
  adapter.delete(key)
168
- adapter.key?(key).should be_false
168
+ expect(adapter.key?(key)).to be(false)
169
169
  end
170
170
  end
171
171
 
172
172
  context "when key not available" do
173
173
  it "does not complain" do
174
- adapter.key?(key).should be_false
174
+ expect(adapter.key?(key)).to be(false)
175
175
  adapter.delete(key)
176
- adapter.key?(key).should be_false
176
+ expect(adapter.key?(key)).to be(false)
177
177
  end
178
178
  end
179
179
 
@@ -188,11 +188,11 @@ shared_examples_for "an adapter" do
188
188
  it "removes all available keys" do
189
189
  adapter.write(key, attributes)
190
190
  adapter.write(key2, attributes2)
191
- adapter.key?(key).should be_true
192
- adapter.key?(key2).should be_true
191
+ expect(adapter.key?(key)).to be(true)
192
+ expect(adapter.key?(key2)).to be(true)
193
193
  adapter.clear
194
- adapter.key?(key).should be_false
195
- adapter.key?(key2).should be_false
194
+ expect(adapter.key?(key)).to be(false)
195
+ expect(adapter.key?(key2)).to be(false)
196
196
  end
197
197
 
198
198
  it "accepts options" do
@@ -1,3 +1,3 @@
1
1
  module Adapter
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -14,7 +14,7 @@ describe Adapter do
14
14
  describe ".definitions" do
15
15
  it "defaults to empty hash" do
16
16
  Adapter.instance_variable_set("@definitions", nil)
17
- Adapter.definitions.should == {}
17
+ expect(Adapter.definitions).to eq({})
18
18
  end
19
19
  end
20
20
 
@@ -22,7 +22,7 @@ describe Adapter do
22
22
  describe "with string name" do
23
23
  it "symbolizes string adapter names" do
24
24
  Adapter.define('memory', valid_module)
25
- Adapter.definitions.keys.should include(:memory)
25
+ expect(Adapter.definitions.keys).to include(:memory)
26
26
  end
27
27
  end
28
28
 
@@ -34,17 +34,17 @@ describe Adapter do
34
34
  let(:mod) { @mod }
35
35
 
36
36
  it "adds adapter to definitions" do
37
- Adapter.definitions.should have_key(:memory)
38
- Adapter.definitions[:memory].should be_instance_of(Module)
37
+ expect(Adapter.definitions).to have_key(:memory)
38
+ expect(Adapter.definitions[:memory]).to be_instance_of(Module)
39
39
  end
40
40
 
41
41
  it "includes the defaults" do
42
42
  Class.new do
43
43
  include Adapter.definitions[:memory]
44
44
  end.tap do |klass|
45
- klass.new.respond_to?(:fetch).should be_true
46
- klass.new.respond_to?(:key?).should be_true
47
- klass.new.respond_to?(:read_multiple).should be_true
45
+ expect(klass.new.respond_to?(:fetch)).to be(true)
46
+ expect(klass.new.respond_to?(:key?)).to be(true)
47
+ expect(klass.new.respond_to?(:read_multiple)).to be(true)
48
48
  end
49
49
  end
50
50
 
@@ -52,9 +52,9 @@ describe Adapter do
52
52
  it "raises error if #{method_name} is not defined in module" do
53
53
  mod.send(:undef_method, method_name)
54
54
 
55
- lambda do
55
+ expect do
56
56
  Adapter.define(:memory, mod)
57
- end.should raise_error(Adapter::IncompleteAPI, "Missing methods needed to complete API (#{method_name})")
57
+ end.to raise_error(Adapter::IncompleteAPI, "Missing methods needed to complete API (#{method_name})")
58
58
  end
59
59
  end
60
60
  end
@@ -81,11 +81,11 @@ describe Adapter do
81
81
  end
82
82
 
83
83
  it "adds adapter to definitions" do
84
- Adapter.definitions.should have_key(:memory)
84
+ expect(Adapter.definitions).to have_key(:memory)
85
85
  end
86
86
 
87
87
  it "modularizes the block" do
88
- Adapter.definitions[:memory].should be_instance_of(Module)
88
+ expect(Adapter.definitions[:memory]).to be_instance_of(Module)
89
89
  end
90
90
  end
91
91
 
@@ -101,10 +101,10 @@ describe Adapter do
101
101
  it "includes block after module" do
102
102
  adapter = Adapter[:memory].new({})
103
103
  adapter.write('foo', 'bar')
104
- adapter.read('foo').should == 'bar'
105
- lambda do
104
+ expect(adapter.read('foo')).to eq('bar')
105
+ expect do
106
106
  adapter.clear
107
- end.should raise_error('Not Implemented')
107
+ end.to raise_error('Not Implemented')
108
108
  end
109
109
  end
110
110
  end
@@ -119,11 +119,11 @@ describe Adapter do
119
119
  end
120
120
 
121
121
  it "unmemoizes adapter by name" do
122
- Adapter[:memory].should_not equal(@memoized_memory)
122
+ expect(Adapter[:memory]).not_to equal(@memoized_memory)
123
123
  end
124
124
 
125
125
  it "does not unmemoize other adapters" do
126
- Adapter[:hash].should equal(@memoized_hash)
126
+ expect(Adapter[:hash]).to equal(@memoized_hash)
127
127
  end
128
128
  end
129
129
 
@@ -135,22 +135,22 @@ describe Adapter do
135
135
  it "returns adapter instance" do
136
136
  adapter = Adapter[:memory].new({})
137
137
  adapter.write('foo', 'bar')
138
- adapter.read('foo').should == 'bar'
138
+ expect(adapter.read('foo')).to eq('bar')
139
139
  adapter.delete('foo')
140
- adapter.read('foo').should be_nil
140
+ expect(adapter.read('foo')).to be_nil
141
141
  adapter.write('foo', 'bar')
142
142
  adapter.clear
143
- adapter.read('foo').should be_nil
143
+ expect(adapter.read('foo')).to be_nil
144
144
  end
145
145
 
146
146
  it "raises error for undefined adapter" do
147
- lambda do
147
+ expect do
148
148
  Adapter[:non_existant]
149
- end.should raise_error(Adapter::Undefined)
149
+ end.to raise_error(Adapter::Undefined)
150
150
  end
151
151
 
152
152
  it "memoizes adapter by name" do
153
- Adapter[:memory].should equal(Adapter[:memory])
153
+ expect(Adapter[:memory]).to equal(Adapter[:memory])
154
154
  end
155
155
  end
156
156
 
@@ -166,55 +166,55 @@ describe Adapter do
166
166
  it "works with options" do
167
167
  Adapter.define(:memory, valid_module)
168
168
  adapter = Adapter[:memory].new({}, :namespace => 'foo')
169
- adapter.options[:namespace].should == 'foo'
169
+ expect(adapter.options[:namespace]).to eq('foo')
170
170
  end
171
171
  end
172
172
 
173
173
  describe "#name" do
174
174
  it "returns adapter name" do
175
- adapter.name.should be(:memory)
175
+ expect(adapter.name).to be(:memory)
176
176
  end
177
177
  end
178
178
 
179
179
  describe "#fetch" do
180
180
  it "returns value if key found" do
181
181
  adapter.write('foo', 'bar')
182
- adapter.fetch('foo', 'baz').should == 'bar'
182
+ expect(adapter.fetch('foo', 'baz')).to eq('bar')
183
183
  end
184
184
 
185
185
  it "returns default value if not key found" do
186
- adapter.fetch('foo', 'baz').should == 'baz'
186
+ expect(adapter.fetch('foo', 'baz')).to eq('baz')
187
187
  end
188
188
 
189
189
  describe "with block" do
190
190
  it "returns value if key found" do
191
191
  adapter.write('foo', 'bar')
192
- adapter.should_not_receive(:write)
193
- adapter.fetch('foo') do
194
- 'baz'
195
- end.should == 'bar'
192
+ expect(adapter).not_to receive(:write)
193
+ expect(adapter.fetch('foo') do
194
+ 'baz'
195
+ end).to eq('bar')
196
196
  end
197
197
 
198
198
  it "returns default if key not found" do
199
- adapter.fetch('foo', 'default').should == 'default'
199
+ expect(adapter.fetch('foo', 'default')).to eq('default')
200
200
  end
201
201
 
202
202
  it "returns result of block if key not found" do
203
- adapter.fetch('foo') do
204
- 'baz'
205
- end.should == 'baz'
203
+ expect(adapter.fetch('foo') do
204
+ 'baz'
205
+ end).to eq('baz')
206
206
  end
207
207
 
208
208
  it "returns key if result of block writes key" do
209
- adapter.fetch('foo', 'default') do
210
- adapter.write('foo', 'write in block')
211
- end.should == 'write in block'
209
+ expect(adapter.fetch('foo', 'default') do
210
+ adapter.write('foo', 'write in block')
211
+ end).to eq('write in block')
212
212
  end
213
213
 
214
214
  it "yields key to block" do
215
- adapter.fetch('foo') do |key|
216
- key
217
- end.should == 'foo'
215
+ expect(adapter.fetch('foo') do |key|
216
+ key
217
+ end).to eq('foo')
218
218
  end
219
219
  end
220
220
  end
@@ -222,41 +222,41 @@ describe Adapter do
222
222
  describe "#key?" do
223
223
  it "returns true if key is set" do
224
224
  adapter.write('foo', 'bar')
225
- adapter.key?('foo').should be_true
225
+ expect(adapter.key?('foo')).to be(true)
226
226
  end
227
227
 
228
228
  it "returns false if key is not set" do
229
- adapter.key?('foo').should be_false
229
+ expect(adapter.key?('foo')).to be(false)
230
230
  end
231
231
  end
232
232
 
233
233
  describe "#eql?" do
234
234
  it "returns true if same name and client" do
235
- adapter.should eql(Adapter[:memory].new({}))
235
+ expect(adapter).to eql(Adapter[:memory].new({}))
236
236
  end
237
237
 
238
238
  it "returns false if different name" do
239
239
  Adapter.define(:hash, valid_module)
240
- adapter.should_not eql(Adapter[:hash].new({}))
240
+ expect(adapter).not_to eql(Adapter[:hash].new({}))
241
241
  end
242
242
 
243
243
  it "returns false if different client" do
244
- adapter.should_not eql(Adapter[:memory].new(Object.new))
244
+ expect(adapter).not_to eql(Adapter[:memory].new(Object.new))
245
245
  end
246
246
  end
247
247
 
248
248
  describe "#==" do
249
249
  it "returns true if same name and client" do
250
- adapter.should == Adapter[:memory].new({})
250
+ expect(adapter).to eq(Adapter[:memory].new({}))
251
251
  end
252
252
 
253
253
  it "returns false if different name" do
254
254
  Adapter.define(:hash, valid_module)
255
- adapter.should_not == Adapter[:hash].new({})
255
+ expect(adapter).not_to eq(Adapter[:hash].new({}))
256
256
  end
257
257
 
258
258
  it "returns false if different client" do
259
- adapter.should_not == Adapter[:memory].new(Object.new)
259
+ expect(adapter).not_to eq(Adapter[:memory].new(Object.new))
260
260
  end
261
261
  end
262
262
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
5
- prerelease:
4
+ version: 0.7.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - John Nunemaker
@@ -11,7 +10,7 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2012-11-16 00:00:00.000000000 Z
13
+ date: 2015-12-30 00:00:00.000000000 Z
15
14
  dependencies: []
16
15
  description:
17
16
  email:
@@ -22,9 +21,9 @@ executables: []
22
21
  extensions: []
23
22
  extra_rdoc_files: []
24
23
  files:
25
- - .gitignore
26
- - .rspec
27
- - .travis.yml
24
+ - ".gitignore"
25
+ - ".rspec"
26
+ - ".travis.yml"
28
27
  - Changelog.md
29
28
  - Gemfile
30
29
  - Guardfile
@@ -47,33 +46,26 @@ files:
47
46
  - spec/support/module_helpers.rb
48
47
  homepage: http://github.com/jnunemaker/adapter
49
48
  licenses: []
49
+ metadata: {}
50
50
  post_install_message:
51
51
  rdoc_options: []
52
52
  require_paths:
53
53
  - lib
54
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
55
  requirements:
57
- - - ! '>='
56
+ - - ">="
58
57
  - !ruby/object:Gem::Version
59
58
  version: '0'
60
- segments:
61
- - 0
62
- hash: -3971462986522991122
63
59
  required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
60
  requirements:
66
- - - ! '>='
61
+ - - ">="
67
62
  - !ruby/object:Gem::Version
68
63
  version: '0'
69
- segments:
70
- - 0
71
- hash: -3971462986522991122
72
64
  requirements: []
73
65
  rubyforge_project:
74
- rubygems_version: 1.8.23
66
+ rubygems_version: 2.4.5.1
75
67
  signing_key:
76
- specification_version: 3
68
+ specification_version: 4
77
69
  summary: A simple interface to anything
78
70
  test_files:
79
71
  - spec/adapter/memory_spec.rb