From 4a8015b119303ee2e5b1abd31d76c9cb6f5406a6 Mon Sep 17 00:00:00 2001 From: John Wood Date: Thu, 7 Jan 2010 08:51:06 -0600 Subject: [PATCH] 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 --- spec/couchrest/more/extended_doc_view_spec.rb | 4 ---- spec/fixtures/more/article.rb | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/spec/couchrest/more/extended_doc_view_spec.rb b/spec/couchrest/more/extended_doc_view_spec.rb index de14f63..bf75f2d 100644 --- a/spec/couchrest/more/extended_doc_view_spec.rb +++ b/spec/couchrest/more/extended_doc_view_spec.rb @@ -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 diff --git a/spec/fixtures/more/article.rb b/spec/fixtures/more/article.rb index 6f4bb7a..dbc9e8c 100644 --- a/spec/fixtures/more/article.rb +++ b/spec/fixtures/more/article.rb @@ -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 \ No newline at end of file +end