Permalink
Browse files

Change range spec to use string ranges rather than integers since Ria…

…k compares strings.
  • Loading branch information...
1 parent 8a31410 commit bbbc5b4909c1c756ee0e176c478fc54b3e90d93f @pgr0ss pgr0ss committed Mar 19, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 spec/curator/shared_data_store_specs.rb
@@ -26,11 +26,12 @@
end
it "returns objects by key within a range" do
- data_store.save(:collection_name => "test_collection", :key => "key1", :value => {:indexed_key => 5}, :index => {:indexed_key => 5})
- data_store.save(:collection_name => "test_collection", :key => "key2", :value => {:indexed_key => 10}, :index => {:indexed_key => 10})
+ data_store.save(:collection_name => "test_collection", :key => "key1", :value => {:indexed_key => 'e'}, :index => {:indexed_key => 'e'})
+ data_store.save(:collection_name => "test_collection", :key => "key2", :value => {:indexed_key => 'g'}, :index => {:indexed_key => 'g'})
- keys = data_store.find_by_index("test_collection", :indexed_key, (1..7)).map { |data| data[:key] }
- keys.should == ["key1"]
+ data_store.find_by_index("test_collection", :indexed_key, ('a'..'f')).map { |data| data[:key] }.should == ["key1"]
+ data_store.find_by_index("test_collection", :indexed_key, ('f'..'h')).map { |data| data[:key] }.should == ["key2"]
+ data_store.find_by_index("test_collection", :indexed_key, ('a'..'h')).map { |data| data[:key] }.sort.should == ["key1", "key2"]
end
end

0 comments on commit bbbc5b4

Please sign in to comment.