mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-29 19:51:00 -05:00
33 lines
753 B
Ruby
33 lines
753 B
Ruby
require 'spec_helper'
|
|
|
|
describe Forum do
|
|
before(:each) do
|
|
@forum = FactoryGirl.create(:forum)
|
|
end
|
|
|
|
it "belongs to an owner" do
|
|
@forum.owner.should be_an_instance_of Member
|
|
end
|
|
|
|
it "stringifies nicely" do
|
|
"#{@forum}".should eq @forum.name
|
|
end
|
|
|
|
it 'has a slug' do
|
|
@forum.slug.should eq 'permaculture'
|
|
end
|
|
|
|
it "has many posts" do
|
|
@post1 = FactoryGirl.create(:forum_post, :forum => @forum)
|
|
@post2 = FactoryGirl.create(:forum_post, :forum => @forum)
|
|
@forum.posts.length.should == 2
|
|
end
|
|
|
|
it "orders posts in reverse chron order" do
|
|
@post1 = FactoryGirl.create(:forum_post, :forum => @forum)
|
|
@post2 = FactoryGirl.create(:forum_post, :forum => @forum)
|
|
@forum.posts.first.should eq @post2
|
|
end
|
|
|
|
end
|