spec/adapter/defaults_spec.rb in adapter-0.5.2 vs spec/adapter/defaults_spec.rb in adapter-0.6.0
- old
+ new
@@ -6,35 +6,28 @@
m.extend(Adapter::Defaults)
end
end
describe "#key_for" do
- it "returns value for string" do
- mod.key_for('foo').should == 'foo'
+ it "returns whatever is passed to it" do
+ [nil, 'foo', :foo, {:foo => 'bar'}].each do |key|
+ mod.key_for(key).should be(key)
+ end
end
-
- it "returns string for symbol" do
- mod.key_for(:foo).should == 'foo'
- end
-
- it "marshals anything not a string or symbol" do
- mod.key_for({'testing' => 'this'}).should == %Q(\004\b{\006\"\ftesting\"\tthis)
- end
end
describe "#encode" do
- it "marshals value" do
- mod.encode(nil).should == "\004\b0"
- mod.encode({'testing' => 'this'}).should == %Q(\004\b{\006\"\ftesting\"\tthis)
+ it "returns whatever is passed to it" do
+ [nil, 'foo', :foo, {:foo => 'bar'}].each do |value|
+ mod.encode(value).should be(value)
+ end
end
end
describe "#decode" do
- it "returns nil if nil" do
- mod.decode(nil).should be_nil
+ it "returns whatever is passed to it" do
+ [nil, 'foo', :foo, {:foo => 'bar'}].each do |value|
+ mod.decode(value).should be(value)
+ end
end
-
- it "returns marshal load if not nil" do
- mod.decode(%Q(\004\b{\006\"\ftesting\"\tthis)).should == {'testing' => 'this'}
- end
end
-end
\ No newline at end of file
+end