Skip to content

Commit

Permalink
some specs for a simple key API in View
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Andreev committed May 1, 2008
1 parent 7c0a123 commit 1a7fc6d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/lib/strokedb/views/view_spec.rb
Expand Up @@ -69,11 +69,23 @@ def view.map(uuid, doc)
@view.find(:key => @article3).should == [ ]
end

it "should find all the article's comments (simple key API)" do
@view.find(@article1).should == [@comment11, @comment12, @comment13]
@view.find(@article2).should == [@comment21, @comment22]
@view.find(@article3).should == [ ]
end

it "should find all the article's comments in a reverse order" do
@view.find(:key => @article1, :reverse => true).should == [@comment13, @comment12, @comment11]
@view.find(:key => @article2, :reverse => true).should == [@comment22, @comment21]
@view.find(:key => @article3, :reverse => true).should == [ ]
end

it "should find all the article's comments in a reverse order (simple key API)" do
@view.find(@article1, :reverse => true).should == [@comment13, @comment12, @comment11]
@view.find(@article2, :reverse => true).should == [@comment22, @comment21]
@view.find(@article3, :reverse => true).should == [ ]
end

it "should find all the article's comments with limit" do
@view.find(:key => @article1, :limit => 2).should == [@comment11, @comment12]
Expand Down

0 comments on commit 1a7fc6d

Please sign in to comment.