From cf678a45c4b30ca67d5dcb88517557fa2d4fbd67 Mon Sep 17 00:00:00 2001 From: Jared McCorkindale Date: Tue, 19 Feb 2013 22:08:53 +1100 Subject: [PATCH 01/11] add count of comments to posts partial --- app/views/posts/_single.html.haml | 3 ++ spec/views/posts/_single.html.haml_spec.rb | 51 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 spec/views/posts/_single.html.haml_spec.rb diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index f07856c04..977352e98 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -21,3 +21,6 @@ :markdown #{ strip_tags post.body } + .post-comments + = pluralize post.comments.count, "comment" + diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb new file mode 100644 index 000000000..830131c1d --- /dev/null +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe "posts/_single" do + before(:each) do + @post = FactoryGirl.create(:post) + end + + context "0 comments" do + before(:each) do + render :partial => "single", :locals => { + :post => @post + } + end + + it "renders the number of comments" do + rendered.should contain "0 comments" + end + end + + context "1 comment" do + before(:each) do + @comment = FactoryGirl.create(:comment, :post => @post) + render :partial => "single", :locals => { + :post => @post + } + end + + it "renders the number of comments" do + rendered.should contain "1 comment" + end + end + + context "2 comments" do + before(:each) do + @comment = FactoryGirl.create(:comment, :post => @post) + @comment2 = FactoryGirl.create(:comment, :post => @post) + render :partial => "single", :locals => { + :post => @post + } + end + + it "renders the number of comments" do + rendered.should contain "2 comments" + end + end + +end + + + + \ No newline at end of file From 1c1fac0aa56a1333d683e0b0aa9287df61c1c7f4 Mon Sep 17 00:00:00 2001 From: Jared McCorkindale Date: Tue, 19 Feb 2013 22:52:13 +1100 Subject: [PATCH 02/11] hiding comment count from post show --- app/views/posts/_single.html.haml | 6 ++++-- app/views/posts/show.html.haml | 2 +- spec/views/posts/_single.html.haml_spec.rb | 12 ++++++++++++ spec/views/posts/show.html.haml_spec.rb | 15 +++++++++++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index 977352e98..f5381f0dc 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -20,7 +20,9 @@ .post-body :markdown #{ strip_tags post.body } + + - unless defined?(hide_comments) + .post-comments + = pluralize post.comments.count, "comment" - .post-comments - = pluralize post.comments.count, "comment" diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index 7813e8501..eb52b128e 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -1,6 +1,6 @@ = content_for :title, @post.subject -= render :partial => "single", :locals => { :post => @post, :subject => false } += render :partial => "single", :locals => { :post => @post, :subject => false, :hide_comments => true } - if can? :edit, @post or can? :destroy, @post .post-actions diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index 830131c1d..deaa023f5 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -44,6 +44,18 @@ describe "posts/_single" do end end + context "hide comment" do + before(:each) do + @comment = FactoryGirl.create(:comment, :post => @post) + render :partial => "single", :locals => { + :post => @post, :hide_comments => true + } + end + + it "renders no value of comments" do + rendered.should_not contain "1 comment" + end + end end diff --git a/spec/views/posts/show.html.haml_spec.rb b/spec/views/posts/show.html.haml_spec.rb index 4785412d5..946e71272 100644 --- a/spec/views/posts/show.html.haml_spec.rb +++ b/spec/views/posts/show.html.haml_spec.rb @@ -42,6 +42,14 @@ describe "posts/show" do rendered.should contain @comment.body end + it 'shows comment count only 1' do + @post = assign(:post, + FactoryGirl.create(:html_post, :author => @author)) + @comment = FactoryGirl.create(:comment, :post => @post) + render + assert_select "div.post_comments", false + end + context "forum post" do it "shows forum name" do @post = assign(:post, @@ -50,7 +58,7 @@ describe "posts/show" do rendered.should contain "in #{@post.forum.name}" end end - + context "signed in" do before(:each) do sign_in @author @@ -62,8 +70,11 @@ describe "posts/show" do it 'shows a comment button' do assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", "Comment" - end + end end + + + end From 67d89826f4ba2441cca30d453cdcc26fd69c6066 Mon Sep 17 00:00:00 2001 From: Jared McCorkindale Date: Tue, 19 Feb 2013 23:08:24 +1100 Subject: [PATCH 03/11] add link to comment value --- app/views/posts/_single.html.haml | 2 +- spec/views/posts/_single.html.haml_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index f5381f0dc..11bf3c28f 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -23,6 +23,6 @@ - unless defined?(hide_comments) .post-comments - = pluralize post.comments.count, "comment" + = link_to pluralize(post.comments.count, "comment"), post diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index deaa023f5..7ee7e1c77 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -28,6 +28,10 @@ describe "posts/_single" do it "renders the number of comments" do rendered.should contain "1 comment" end + + it "contains a link to post" do + assert_select "a[href=#{post_path @post}]" + end end context "2 comments" do @@ -55,6 +59,10 @@ describe "posts/_single" do it "renders no value of comments" do rendered.should_not contain "1 comment" end + + it "does not contain link to post" do + assert_select "a[href=#{post_path @post}]", false + end end end From 5f4d989cbd5b90016a1b3d0aca59b0d64c1553e2 Mon Sep 17 00:00:00 2001 From: Jared McCorkindale Date: Tue, 19 Feb 2013 23:30:26 +1100 Subject: [PATCH 04/11] add read link to post single and comment link --- app/views/posts/_single.html.haml | 5 ++++- spec/views/posts/_single.html.haml_spec.rb | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index 11bf3c28f..80d0ea518 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -23,6 +23,9 @@ - unless defined?(hide_comments) .post-comments - = link_to pluralize(post.comments.count, "comment"), post + = pluralize(post.comments.count, "comment") + = link_to "Read", post + %br + = link_to "Comment", new_comment_path(:post_id => post.id) diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index 7ee7e1c77..c6a95f54a 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -32,6 +32,10 @@ describe "posts/_single" do it "contains a link to post" do assert_select "a[href=#{post_path @post}]" end + + it "contains link to new comment" do + assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", "Comment" + end end context "2 comments" do @@ -63,6 +67,11 @@ describe "posts/_single" do it "does not contain link to post" do assert_select "a[href=#{post_path @post}]", false end + + it "does not contain link to new comment" do + assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", false + end + end end From 5a18fcc0b4bed881657f79b3922a770209af3bc4 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Sun, 24 Feb 2013 12:42:50 +0000 Subject: [PATCH 05/11] Use a ul.inline for "N comments | Comment" links. --- app/views/posts/_single.html.haml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index 80d0ea518..a66a3f720 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -23,9 +23,8 @@ - unless defined?(hide_comments) .post-comments - = pluralize(post.comments.count, "comment") - = link_to "Read", post - %br - = link_to "Comment", new_comment_path(:post_id => post.id) + %ul.inline + %li= link_to pluralize(post.comments.count, "comment"), post + %li= link_to "Comment", new_comment_path(:post_id => post.id) From 3c13be2c0a4763f7f7190cbc7817104670134d75 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 27 Feb 2013 11:56:13 +0000 Subject: [PATCH 06/11] Left-align comment links in posts. --- app/assets/stylesheets/bootstrap_and_overrides.css.less | 3 +++ app/views/posts/_single.html.haml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index d87769d3e..4b9b36ad2 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -32,3 +32,6 @@ body { padding-bottom: @navbarHeight + 10px; } +ul.inline > li.first { + padding-left: 0px; +} diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index a66a3f720..9cc18d64b 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -24,7 +24,7 @@ - unless defined?(hide_comments) .post-comments %ul.inline - %li= link_to pluralize(post.comments.count, "comment"), post + %li.first= link_to pluralize(post.comments.count, "comment"), post %li= link_to "Comment", new_comment_path(:post_id => post.id) From a1fcafc1a31b0225a1e6fcba6ce4c7e531846ef4 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 27 Feb 2013 11:59:39 +0000 Subject: [PATCH 07/11] Give contexts in posts/single tests more descriptive names. --- spec/views/posts/_single.html.haml_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index c6a95f54a..ab8354b8d 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -5,7 +5,7 @@ describe "posts/_single" do @post = FactoryGirl.create(:post) end - context "0 comments" do + context "when there are no comments" do before(:each) do render :partial => "single", :locals => { :post => @post @@ -17,7 +17,7 @@ describe "posts/_single" do end end - context "1 comment" do + context "when there is 1 comment" do before(:each) do @comment = FactoryGirl.create(:comment, :post => @post) render :partial => "single", :locals => { @@ -38,7 +38,7 @@ describe "posts/_single" do end end - context "2 comments" do + context "when there are 2 comments" do before(:each) do @comment = FactoryGirl.create(:comment, :post => @post) @comment2 = FactoryGirl.create(:comment, :post => @post) @@ -52,7 +52,7 @@ describe "posts/_single" do end end - context "hide comment" do + context "when comments should be hidden" do before(:each) do @comment = FactoryGirl.create(:comment, :post => @post) render :partial => "single", :locals => { @@ -77,4 +77,4 @@ end - \ No newline at end of file + From ade199c17b1cfc357359fad5f4cf1949b6dbc150 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 27 Feb 2013 12:50:16 +0000 Subject: [PATCH 08/11] Better links for posts. - add Permalink - show Reply instead of "Comment" (iff you can comment) - Edit link shows if you have permission to edit - reorganised tests for post/_single - posts/_single now requires current_user; patch tests for comments. --- app/views/posts/_single.html.haml | 6 +- spec/views/comments/edit.html.haml_spec.rb | 1 + spec/views/comments/new.html.haml_spec.rb | 1 + spec/views/posts/_single.html.haml_spec.rb | 72 +++++++++++++++++----- 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index 9cc18d64b..d08c586ef 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -25,6 +25,10 @@ .post-comments %ul.inline %li.first= link_to pluralize(post.comments.count, "comment"), post - %li= link_to "Comment", new_comment_path(:post_id => post.id) + -if can? :create, Comment + %li= link_to "Reply", new_comment_path(:post_id => post.id) + %li= link_to "Permalink", post + -if can? :edit, post + %li= link_to "Edit", edit_post_path(post) diff --git a/spec/views/comments/edit.html.haml_spec.rb b/spec/views/comments/edit.html.haml_spec.rb index d872d33d4..beee78013 100644 --- a/spec/views/comments/edit.html.haml_spec.rb +++ b/spec/views/comments/edit.html.haml_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe "comments/edit" do before(:each) do + controller.stub(:current_user) { nil } assign(:comment, FactoryGirl.create(:comment)) end diff --git a/spec/views/comments/new.html.haml_spec.rb b/spec/views/comments/new.html.haml_spec.rb index beb01c9d0..59fe03d7f 100644 --- a/spec/views/comments/new.html.haml_spec.rb +++ b/spec/views/comments/new.html.haml_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe "comments/new" do before(:each) do + controller.stub(:current_user) { nil } assign(:comment, FactoryGirl.create(:comment)) end diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index ab8354b8d..12e3dd58e 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -1,15 +1,64 @@ require 'spec_helper' describe "posts/_single" do + + def render_post() + render :partial => "single", :locals => { :post => @post } + end + before(:each) do @post = FactoryGirl.create(:post) + controller.stub(:current_user) { nil } + end + + context "when the number of comments doesn't matter" do + before(:each) do + render_post + end + + it "contains a permanent link to post" do + assert_select "a[href=#{post_path @post}]", "Permalink" + end + + it "doesn't contain a link to new comment" do + assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", false + end + end + + context "when logged in" do + before(:each) do + @member = FactoryGirl.create(:member) + sign_in @member + controller.stub(:current_user) { @member } + render_post + end + + it "contains link to new comment" do + assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", "Reply" + end + + it "does not contain an edit link" do + assert_select "a[href=#{edit_post_path(@post)}]", false + end + end + + context "when logged in as post author" do + before(:each) do + @member = FactoryGirl.create(:member) + sign_in @member + controller.stub(:current_user) { @member } + @post = FactoryGirl.create(:post, :author => @member) + render_post + end + + it "contains an edit link" do + assert_select "a[href=#{edit_post_path(@post)}]", "Edit" + end end context "when there are no comments" do before(:each) do - render :partial => "single", :locals => { - :post => @post - } + render_post end it "renders the number of comments" do @@ -20,9 +69,7 @@ describe "posts/_single" do context "when there is 1 comment" do before(:each) do @comment = FactoryGirl.create(:comment, :post => @post) - render :partial => "single", :locals => { - :post => @post - } + render_post end it "renders the number of comments" do @@ -32,19 +79,13 @@ describe "posts/_single" do it "contains a link to post" do assert_select "a[href=#{post_path @post}]" end - - it "contains link to new comment" do - assert_select "a[href=#{new_comment_path(:post_id => @post.id)}]", "Comment" - end end context "when there are 2 comments" do before(:each) do @comment = FactoryGirl.create(:comment, :post => @post) @comment2 = FactoryGirl.create(:comment, :post => @post) - render :partial => "single", :locals => { - :post => @post - } + render_post end it "renders the number of comments" do @@ -54,6 +95,9 @@ describe "posts/_single" do context "when comments should be hidden" do before(:each) do + @member = FactoryGirl.create(:member) + sign_in @member + controller.stub(:current_user) { @member } @comment = FactoryGirl.create(:comment, :post => @post) render :partial => "single", :locals => { :post => @post, :hide_comments => true @@ -65,7 +109,7 @@ describe "posts/_single" do end it "does not contain link to post" do - assert_select "a[href=#{post_path @post}]", false + assert_select "a[href=#{post_path @post}]", false end it "does not contain link to new comment" do From e7a1beb3237af83cb27a7305ba8ff18c7b747523 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 27 Feb 2013 13:26:35 +0000 Subject: [PATCH 09/11] Add anchor tag for comments in posts/show. --- app/views/posts/show.html.haml | 5 ++-- spec/views/posts/show.html.haml_spec.rb | 32 +++++++++++++++++-------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index eb52b128e..f74ce6d81 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -11,11 +11,10 @@ data: { confirm: 'Are you sure?' }, :class => 'btn' +%a{:name => "comments"} - if @post.comments.length > 0 %h2 - =@post.comments.length - =@post.comments.length == 1 ? 'comment' : 'comments' - + =pluralize(@post.comments.length, "comment") - @post.comments.each do |c| = render :partial => "comments/single", :locals => { :comment => c } diff --git a/spec/views/posts/show.html.haml_spec.rb b/spec/views/posts/show.html.haml_spec.rb index 946e71272..aadf31a29 100644 --- a/spec/views/posts/show.html.haml_spec.rb +++ b/spec/views/posts/show.html.haml_spec.rb @@ -34,20 +34,32 @@ describe "posts/show" do rendered.should_not match(/a href="http:\/\/evil.com"/) end - it "shows comments" do + it 'has an anchor to the comments' do @post = assign(:post, - FactoryGirl.create(:html_post, :author => @author)) - @comment = FactoryGirl.create(:comment, :post => @post) + FactoryGirl.create(:post, :author => @author)) render - rendered.should contain @comment.body + assert_select 'a[name=comments]' end - it 'shows comment count only 1' do - @post = assign(:post, - FactoryGirl.create(:html_post, :author => @author)) - @comment = FactoryGirl.create(:comment, :post => @post) - render - assert_select "div.post_comments", false + context "when there is one comment" do + before(:each) do + @post = assign(:post, + FactoryGirl.create(:html_post, :author => @author)) + @comment = FactoryGirl.create(:comment, :post => @post) + render + end + + it 'shows comment count only 1' do + assert_select "div.post_comments", false + end + + it "shows comments" do + rendered.should contain @comment.body + end + + it 'has an anchor to the comments' do + assert_select 'a[name=comments]' + end end context "forum post" do From e470cf7358349c2b1488a964842225d47b7e2fa2 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Wed, 27 Feb 2013 13:45:30 +0000 Subject: [PATCH 10/11] Send "N comments" links to the comments anchors. We have to call post.save in the posts/index specs, because post_path fails unless the post has been persisted (and hence had its slug generated). I think. That fixed the failing tests, anyway. --- app/views/posts/_single.html.haml | 3 ++- spec/views/posts/_single.html.haml_spec.rb | 10 +++------- spec/views/posts/index.html.haml_spec.rb | 2 ++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index d08c586ef..abc2fcc5f 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -24,7 +24,8 @@ - unless defined?(hide_comments) .post-comments %ul.inline - %li.first= link_to pluralize(post.comments.count, "comment"), post + %li.first= link_to pluralize(post.comments.count, "comment"), + post_path(post, :anchor => 'comments') -if can? :create, Comment %li= link_to "Reply", new_comment_path(:post_id => post.id) %li= link_to "Permalink", post diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index 12e3dd58e..eebac11f4 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -62,7 +62,7 @@ describe "posts/_single" do end it "renders the number of comments" do - rendered.should contain "0 comments" + assert_select "a[href=#{post_path(@post)}\#comments]", "0 comments" end end @@ -73,11 +73,7 @@ describe "posts/_single" do end it "renders the number of comments" do - rendered.should contain "1 comment" - end - - it "contains a link to post" do - assert_select "a[href=#{post_path @post}]" + assert_select "a[href=#{post_path(@post)}\#comments]", "1 comment" end end @@ -89,7 +85,7 @@ describe "posts/_single" do end it "renders the number of comments" do - rendered.should contain "2 comments" + assert_select "a[href=#{post_path(@post)}\#comments]", "2 comments" end end diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb index fd73a3a9f..684009801 100644 --- a/spec/views/posts/index.html.haml_spec.rb +++ b/spec/views/posts/index.html.haml_spec.rb @@ -6,6 +6,8 @@ describe "posts/index" do @author = FactoryGirl.create(:member) @post1 = FactoryGirl.build(:post, :author => @author) @post2 = FactoryGirl.build(:post, :author => @author) + @post1.save # needed to generate slugs and hence paths for posts + @post2.save assign(:posts, [@post1, @post2]) render end From 8b47773b59d4ca17da05a7eac7a0a391e1079bf6 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Mon, 4 Mar 2013 11:57:59 +0000 Subject: [PATCH 11/11] Clean up post view specs as per Skud's comments. See https://github.com/pozorvlak/growstuff/commit/e470cf7358349c2b1488a964842225d47b7e2fa2#commitcomment-2732846 --- spec/views/posts/index.html.haml_spec.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb index 684009801..43b24b006 100644 --- a/spec/views/posts/index.html.haml_spec.rb +++ b/spec/views/posts/index.html.haml_spec.rb @@ -4,10 +4,9 @@ describe "posts/index" do before(:each) do controller.stub(:current_user) { nil } @author = FactoryGirl.create(:member) - @post1 = FactoryGirl.build(:post, :author => @author) - @post2 = FactoryGirl.build(:post, :author => @author) - @post1.save # needed to generate slugs and hence paths for posts - @post2.save + # We use create (= build+save) to generate slugs and hence paths for posts + @post1 = FactoryGirl.create(:post, :author => @author) + @post2 = FactoryGirl.create(:post, :author => @author) assign(:posts, [@post1, @post2]) render end