Permalink
Browse files

Sketch out an indexes spec

  • Loading branch information...
1 parent 9d3c62c commit 25ba9fc4f396074051d6d9247232a629644f6c41 Kyle Kingsbury committed Apr 26, 2011
Showing with 32 additions and 0 deletions.
  1. +32 −0 spec/indexes.rb
View
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'bacon'
+require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
+
+Bacon.summary_on_exit
+
+class Indexed < Risky
+ include Risky::Indexes
+
+ self.riak = lambda { Riak::Client.new(:host => '127.0.0.1', :protocol => 'pbc') }
+
+ bucket 'indexes'
+ value :value
+ value :unique
+
+ index :value
+ index :unique, :unique => true
+end
+
+describe 'indexes' do
+ before do
+ Indexed.each { |x| x.delete }
+ end
+
+ should 'index a string' do
+ o = Indexed.new 'test', 'value' => 'value'
+ o.save.should.not.be.false
+ Indexed.by_value('value').should === o
+ end
+end

0 comments on commit 25ba9fc

Please sign in to comment.