Commit a3c07153b04c5d8605f8c98d1d99bd50c9a5f5b6
- Date: Wed Apr 30 08:02:36 +0000 2008
- Committer: Yurii Rashkovskii (yrashk@gmail.com)
- Author: Yurii Rashkovskii (yrashk@gmail.com)
- Commit SHA1: a3c07153b04c5d8605f8c98d1d99bd50c9a5f5b6
- Tree SHA1: ba0dfe1523d88bd8c655323f6a66dfd90554bfc0
Better Meta#first and #last specs [#1 state:resolved]
Commit diff
| |   |
| 69 | 69 | it "should return first document if no args are passed to #first" do |
| 70 | 70 | a = SomeName.create!(:slot1 => 1) |
| 71 | 71 | b = SomeName.create!(:slot1 => 2) |
| 72 | | SomeName.first.should == SomeName.find.first |
| 72 | a_and_b = SomeName.find |
| 73 | a_and_b.to_set.should == [a,b].to_set |
| 74 | a_and_b.member?(SomeName.first).should be_true |
| 73 | 75 | end |
| 74 | 76 | |
| 75 | 77 | it "correctly handles finding via UUID on call to #first" do |
| … | … | |
| 88 | 88 | it "should return last document if no args are passed to #last" do |
| 89 | 89 | a = SomeName.create!(:slot1 => 1) |
| 90 | 90 | b = SomeName.create!(:slot1 => 2) |
| 91 | | SomeName.last.should == SomeName.find.last |
| 91 | a_and_b = SomeName.find |
| 92 | a_and_b.to_set.should == [a,b].to_set |
| 93 | a_and_b.member?(SomeName.last).should be_true |
| 92 | 94 | end |
| 93 | 95 | |
| 94 | 96 | it "correctly handles finding via UUID on call to #last" do |
| toggle raw diff |
--- a/spec/lib/strokedb/document/meta_spec.rb
+++ b/spec/lib/strokedb/document/meta_spec.rb
@@ -69,7 +69,9 @@ describe "Meta module", :shared => true do
it "should return first document if no args are passed to #first" do
a = SomeName.create!(:slot1 => 1)
b = SomeName.create!(:slot1 => 2)
- SomeName.first.should == SomeName.find.first
+ a_and_b = SomeName.find
+ a_and_b.to_set.should == [a,b].to_set
+ a_and_b.member?(SomeName.first).should be_true
end
it "correctly handles finding via UUID on call to #first" do
@@ -86,7 +88,9 @@ describe "Meta module", :shared => true do
it "should return last document if no args are passed to #last" do
a = SomeName.create!(:slot1 => 1)
b = SomeName.create!(:slot1 => 2)
- SomeName.last.should == SomeName.find.last
+ a_and_b = SomeName.find
+ a_and_b.to_set.should == [a,b].to_set
+ a_and_b.member?(SomeName.last).should be_true
end
it "correctly handles finding via UUID on call to #last" do |