Move the provides_collection declaration into the Article test fixture, and out of the test, fixing a test case that was failing in ruby 1.9.

Signed-off-by: Will Leinweber <will@bitfission.com>
This commit is contained in:
John Wood 2010-01-07 08:51:06 -06:00 committed by Will Leinweber
parent 08cf9e59b6
commit 4a8015b119
2 changed files with 2 additions and 5 deletions

View file

@ -408,10 +408,6 @@ describe "ExtendedDocument views" do
end
end
it "should provide a class method to get a collection for a view" do
class Article
provides_collection :article_details, 'Article', 'by_date', :descending => true, :include_docs => true
end
articles = Article.find_all_article_details(:key => Date.today)
articles.class.should == Array
articles.size.should == 7

View file

@ -2,6 +2,7 @@ class Article < CouchRest::ExtendedDocument
use_database DB
unique_id :slug
provides_collection :article_details, 'Article', 'by_date', :descending => true, :include_docs => true
view_by :date, :descending => true
view_by :user_id, :date
@ -31,4 +32,4 @@ class Article < CouchRest::ExtendedDocument
def generate_slug_from_title
self['slug'] = title.downcase.gsub(/[^a-z0-9]/,'-').squeeze('-').gsub(/^\-|\-$/,'') if new?
end
end
end