Permalink
Browse files

spec/indexes: fix riak lambda, spec for unique indexes

  • Loading branch information...
1 parent c537689 commit c8d5fad9e4697f7e39ae036c63ee183118d2327c @aphyr committed Jul 8, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 spec/indexes.rb
View
11 spec/indexes.rb
@@ -9,7 +9,7 @@
class Indexed < Risky
include Risky::Indexes
- self.riak = lambda { Riak::Client.new(:host => '127.0.0.1', :protocol => 'pbc') }
+ self.riak = lambda { |k| Riak::Client.new(:host => '127.0.0.1', :protocol => 'pbc') }
bucket 'indexes'
value :value
@@ -29,4 +29,13 @@ class Indexed < Risky
o.save.should.not.be.false
Indexed.by_value('value').should === o
end
+
+ should 'keep values unique (mostly)' do
+ o = Indexed.new '1', 'unique' => 'u'
+ o.save.should.not.be.false
+
+ o2 = Indexed.new '2', 'unique' => 'u'
+ o2.save.should.be.false
+ o2.errors[:unique].should == 'taken'
+ end
end

0 comments on commit c8d5fad

Please sign in to comment.