Sha256: 74ed0c9bbad48291ffdd7da0435aeee19d5baba42266d1ceaa25e8b2184564ef
Contents?: true
Size: 1.55 KB
Versions: 15
Compression:
Stored size: 1.55 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe Topic do dataset :forums describe "on creation" do before do @post = Post.create!( :body => "first post body", :reader_id => reader_id(:normal), :topic_attributes => { :name => 'testing', :forum_id => forum_id(:public) } ) @topic = @post.topic end it "should set default values" do @topic.sticky?.should be_false @topic.locked?.should be_false @topic.replied_by.should == readers(:normal) @topic.replied_at.should be_close(Time.now, 1.minute) end [:name].each do |field| it "should require a #{field}" do @topic.send("#{field}=".intern, nil) @topic.should_not be_valid @topic.errors.on(field).should_not be_empty end end describe "when the whole forum is public" do before do Radiant::Config['forum.public?'] = true end it "should be visible to a reader" do @topic.visible_to?(@reader).should be_true end it "should be visible when there is no reader" do @topic.visible_to?(nil).should be_true end end describe "when the whole forum is private" do before do Radiant::Config['forum.public?'] = false end it "should be visible to a reader" do @topic.visible_to?(readers(:idle)).should be_true end it "should not be visible when there is no reader" do @topic.visible_to?(nil).should be_false end end end end
Version data entries
15 entries across 15 versions & 1 rubygems