Merge pull request #181 from enmasse-entertainment/fix_comment_posting
Fix comment posting
This commit is contained in:
commit
ea2f177b0d
2 changed files with 25 additions and 1 deletions
|
@ -31,7 +31,7 @@ module Refinery
|
||||||
end
|
end
|
||||||
|
|
||||||
def comment
|
def comment
|
||||||
if (@comment = @post.comments.create(params[comment])).valid?
|
if (@comment = @post.comments.create(params[:comment])).valid?
|
||||||
if Comment::Moderation.enabled? or @comment.ham?
|
if Comment::Moderation.enabled? or @comment.ham?
|
||||||
begin
|
begin
|
||||||
CommentMailer.notification(@comment, request).deliver
|
CommentMailer.notification(@comment, request).deliver
|
||||||
|
|
|
@ -77,6 +77,30 @@ module Refinery
|
||||||
page.should_not have_content(blog_comment.body)
|
page.should_not have_content(blog_comment.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when posting comments" do
|
||||||
|
let(:blog_post) { Factory(:blog_post) }
|
||||||
|
let(:name) { "pete" }
|
||||||
|
let(:email) { "pete@mcawesome.com" }
|
||||||
|
let(:body) { "Witty comment." }
|
||||||
|
|
||||||
|
before do
|
||||||
|
visit refinery_blog_post_path(blog_post)
|
||||||
|
|
||||||
|
fill_in "Name", :with => name
|
||||||
|
fill_in "Email", :with => email
|
||||||
|
fill_in "Message", :with => body
|
||||||
|
click_button "Send comment"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "creates the comment" do
|
||||||
|
comment = blog_post.reload.comments.last
|
||||||
|
|
||||||
|
comment.name.should eq(name)
|
||||||
|
comment.email.should eq(email)
|
||||||
|
comment.body.should eq(body)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#show draft preview" do
|
describe "#show draft preview" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue