diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-27 13:46:24 +0300 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-27 13:46:24 +0300 |
commit | 3fa8937b95a4d90000ad1be9c588424052136455 (patch) | |
tree | 07e61cd13bd88a76d13c3d759475d67d088d5f6e /spec/models/blog_category_spec.rb | |
parent | e5db679226bac7ef8ddd568c40f52addd52d7a8a (diff) | |
download | refinerycms-blog-3fa8937b95a4d90000ad1be9c588424052136455.tar.gz refinerycms-blog-3fa8937b95a4d90000ad1be9c588424052136455.tar.bz2 refinerycms-blog-3fa8937b95a4d90000ad1be9c588424052136455.zip |
Rails 3.1 - wip.
Diffstat (limited to 'spec/models/blog_category_spec.rb')
-rw-r--r-- | spec/models/blog_category_spec.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/spec/models/blog_category_spec.rb b/spec/models/blog_category_spec.rb deleted file mode 100644 index 7792744..0000000 --- a/spec/models/blog_category_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogCategory do - before(:each) do - @blog_category = Factory.create(:blog_category) - end - - describe "validations" do - it "requires title" do - Factory.build(:blog_category, :title => "").should_not be_valid - end - - it "won't allow duplicate titles" do - Factory.build(:blog_category, :title => @blog_category.title).should_not be_valid - end - end - - describe "blog posts association" do - it "has a posts attribute" do - @blog_category.should respond_to(:posts) - end - - it "returns posts by published_at date in descending order" do - first_post = @blog_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) - latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now }) - - @blog_category.posts.first.should == latest_post - end - - end - - describe "#post_count" do - it "returns post count in category" do - 2.times do - @blog_category.posts << Factory.create(:blog_post) - end - @blog_category.post_count.should == 2 - end - end -end |