Sha256: 5686c95d735dc795153ae5e685eec7b06438433fbe20e37bd26aac44f6cf9a08
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' context 'Given the results of Category.find_all_with_article_counters' do fixtures :contents, :categories, :categorizations, :blogs setup { @cats = Category.find_all_with_article_counters } specify "Categories should be sorted by category.position" do @cats.should == @cats.sort_by { |c| c.position } end specify "Counts should be correct" do @cats.each do |cat| cat.article_counter.should == cat.published_articles.size end end end context 'Given the fixtures' do fixtures :contents, :categories, :categorizations, :blogs specify 'find gets the order right' do cats = Category.find(:all) cats.should == cats.sort_by { |c| c.position } Category.reorder(cats.reverse.collect { |c| c.id }) Category.find(:all).should == cats.reverse end specify 'can still override order in find' do cats = Category.find(:all, :order => 'name ASC') cats.should == cats.sort_by {|c| c.name} Category.find(:all).should_not == cats end specify '.reorder_alpha puts categories in alphabetical order' do Category.find(:all).should_not == Category.find(:all, :order => :name) Category.reorder_alpha Category.find(:all).should == Category.find(:all, :order => :name) end specify 'A category knows its url' do categories(:software).permalink_url.should == 'http://myblog.net/articles/category/software' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
typo-4.1.1 | spec/models/category_spec.rb |
typo-4.1 | spec/models/category_spec.rb |