Permalink
Browse files

- new test that demostrares query bug for two natural keys

  • Loading branch information...
1 parent 6eac966 commit 7173fa9e57f2e27438ea28484db30e714c81608d Sebastian Feuerstack committed with Dan Herrera Mar 20, 2012
Showing with 17 additions and 2 deletions.
  1. +17 −2 spec/textual_keys_spec.rb
@@ -3,8 +3,8 @@
describe DataMapper::Adapters::RedisAdapter do
before(:all) do
@adapter = DataMapper.setup(:default, {
- :adapter => "redis",
- :db => 15
+ :adapter => "redis",
+ :db => 15
})
end
@@ -24,7 +24,22 @@ class Foo
Foo.create(:hostname => "hostname1", :ip_address => '127.0.0.1')
Foo.first.hostname.should == "hostname1"
+
+ Foo.first(:hostname => "hostname1").ip_address.should == "127.0.0.1"
end
+
+ it "should find elements with two natural keys" do
+ class Foo
+ include DataMapper::Resource
+ property :key1, String, :key => true
+ property :key2, String, :key => true
+ end
+ DataMapper.finalize
+
+ Foo.create(:key1 => "value1", :key2 => 'value2')
+ Foo.first(:key1 => "value1").key2.should == 'value2'
+ end
+
end
describe "textual keys" do

0 comments on commit 7173fa9

Please sign in to comment.