Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adapter specs now use string ids instead of integers.

  • Loading branch information...
commit 8bb9ae45141d1d7331d794a100f511d3d0c7efaa 1 parent 3a2f57e
@chrislloyd chrislloyd authored
Showing with 34 additions and 34 deletions.
  1. +12 −12 lib/flipper/spec/shared_adapter_specs.rb
  2. +22 −22 spec/flipper/adapter_spec.rb
View
24 lib/flipper/spec/shared_adapter_specs.rb
@@ -35,24 +35,24 @@
describe "#set_add" do
it "adds value to store" do
- subject.set_add(key, 1)
- read_key(key).should eq(Set[1])
+ subject.set_add(key, '1')
+ read_key(key).should eq(Set['1'])
end
it "does not add same value more than once" do
- subject.set_add(key, 1)
- subject.set_add(key, 1)
- subject.set_add(key, 1)
- subject.set_add(key, 2)
- read_key(key).should eq(Set[1, 2])
+ subject.set_add(key, '1')
+ subject.set_add(key, '1')
+ subject.set_add(key, '1')
+ subject.set_add(key, '2')
+ read_key(key).should eq(Set['1', '2'])
end
end
describe "#set_delete" do
it "removes value from set if key in store" do
- write_key key, Set[1, 2]
- subject.set_delete(key, 1)
- read_key(key).should eq(Set[2])
+ write_key key, Set['1', '2']
+ subject.set_delete(key, '1')
+ read_key(key).should eq(Set['2'])
end
it "works fine if key not in store" do
@@ -66,8 +66,8 @@
end
it "returns set if in store" do
- write_key key, Set[1, 2]
- subject.set_members(key).should eq(Set[1, 2])
+ write_key key, Set['1', '2']
+ subject.set_members(key).should eq(Set['1', '2'])
end
end
View
44 spec/flipper/adapter_spec.rb
@@ -86,18 +86,18 @@
describe "#set_members" do
before do
- adapter.write 'foo', Set[1, 2]
+ adapter.write 'foo', Set['1', '2']
@result = subject.set_members('foo')
end
it "returns result of adapter set members" do
- @result.should eq(Set[1, 2])
+ @result.should eq(Set['1', '2'])
end
it "memoizes key" do
- local_cache['foo'].should eq(Set[1, 2])
+ local_cache['foo'].should eq(Set['1', '2'])
adapter.should_not_receive(:set_members)
- subject.set_members('foo').should eq(Set[1, 2])
+ subject.set_members('foo').should eq(Set['1', '2'])
end
end
@@ -132,13 +132,13 @@
describe "#set_add" do
before do
- adapter.write 'foo', Set[1]
- local_cache['foo'] = Set[1]
- subject.set_add 'foo', 2
+ adapter.write 'foo', Set['1']
+ local_cache['foo'] = Set['1']
+ subject.set_add 'foo', '2'
end
it "returns result of adapter set members" do
- adapter.set_members('foo').should eq(Set[1, 2])
+ adapter.set_members('foo').should eq(Set['1', '2'])
end
it "unmemoizes key" do
@@ -148,13 +148,13 @@
describe "#set_delete" do
before do
- adapter.write 'foo', Set[1, 2, 3]
- local_cache['foo'] = Set[1, 2, 3]
- subject.set_delete 'foo', 3
+ adapter.write 'foo', Set['1', '2', '3']
+ local_cache['foo'] = Set['1', '2', '3']
+ subject.set_delete 'foo', '3'
end
it "returns result of adapter set members" do
- adapter.set_members('foo').should eq(Set[1, 2])
+ adapter.set_members('foo').should eq(Set['1', '2'])
end
it "unmemoizes key" do
@@ -185,12 +185,12 @@
describe "#set_members" do
before do
- adapter.write 'foo', Set[1, 2]
+ adapter.write 'foo', Set['1', '2']
@result = subject.set_members('foo')
end
it "returns result of adapter set members" do
- @result.should eq(Set[1, 2])
+ @result.should eq(Set['1', '2'])
end
it "does not memoize the adapter set member result" do
@@ -232,13 +232,13 @@
describe "#set_add" do
before do
- adapter.write 'foo', Set[1]
- local_cache['foo'] = Set[1]
- subject.set_add 'foo', 2
+ adapter.write 'foo', Set['1']
+ local_cache['foo'] = Set['1']
+ subject.set_add 'foo', '2'
end
it "performs adapter set add" do
- adapter.set_members('foo').should eq(Set[1, 2])
+ adapter.set_members('foo').should eq(Set['1', '2'])
end
it "does not attempt to delete local cache key" do
@@ -248,13 +248,13 @@
describe "#set_delete" do
before do
- adapter.write 'foo', Set[1, 2, 3]
- local_cache['foo'] = Set[1, 2, 3]
- subject.set_delete 'foo', 3
+ adapter.write 'foo', Set['1', '2', '3']
+ local_cache['foo'] = Set['1', '2', '3']
+ subject.set_delete 'foo', '3'
end
it "performs adapter set delete" do
- adapter.set_members('foo').should eq(Set[1, 2])
+ adapter.set_members('foo').should eq(Set['1', '2'])
end
it "does not attempt to delete local cache key" do
Please sign in to comment.
Something went wrong with that request. Please try again.