spec/models/post_spec.rb in radiant-forum-extension-2.1.6 vs spec/models/post_spec.rb in radiant-forum-extension-3.0.0.rc3
- old
+ new
@@ -21,16 +21,20 @@
end
describe "when added to a topic" do
before do
Rails.logger.warn ">>"
- post = topics(:older).posts.create!(:body => 'newly added', :reader => readers(:idle))
+ @post = topics(:older).posts.create!(:body => 'and its my post about new marmalade', :reader => readers(:normal))
end
+ it "should update its indexable form" do
+ @post.search_text.should == "older post new marmalade"
+ end
+
it "should update topic reply data" do
topic = Topic.find(topic_id(:older))
- topic.replied_by.should == readers(:idle)
+ topic.replied_by.should == readers(:normal)
topic.replied_at.should be_close(Time.now, 10.seconds)
end
end
end
@@ -43,11 +47,11 @@
it "should be editable by its author" do
@post.editable_by?(readers(:normal)).should be_true
end
it "should not be editable by anyone else" do
- @post.editable_by?(readers(:idle)).should be_false
+ @post.editable_by?(readers(:another)).should be_false
end
end
describe "after the editable period" do
before do
@@ -58,18 +62,18 @@
it "should not be editable by its author" do
@post.editable_by?(@post.reader).should be_false
end
it "should not be editable by anyone else" do
- @post.editable_by?(readers(:idle)).should be_false
+ @post.editable_by?(readers(:another)).should be_false
end
end
describe "on removal" do
before do
@last = topics(:older).posts.last
- @post = topics(:older).posts.create!(:body => 'uh oh', :reader => readers(:idle))
+ @post = topics(:older).posts.create!(:body => 'uh oh', :reader => readers(:normal))
end
it "should revert topic reply data" do
@post.destroy
topic = Topic.find(topic_id(:older))
topic.replied_by.should == @last.reader
@@ -82,10 +86,10 @@
Radiant::Config['forum.posts_per_page'] = 25
firstpost = topics(:older).posts.create!(:body => 'foo', :reader => readers(:normal))
55.times do |i|
topics(:older).posts.create!(:body => 'rhubarb', :reader => readers(:normal))
end
- lastpost = topics(:older).posts.create!(:body => 'bar', :reader => readers(:idle))
+ lastpost = topics(:older).posts.create!(:body => 'bar', :reader => readers(:normal))
firstpost.page_when_paginated.should == 1
lastpost.page_when_paginated.should == 3
end
end