Files
growstuff/spec/views/comments/new.html.haml_spec.rb
Daniel O'Connor f1acb35520 Merge pull request #4537 from Growstuff/FactoryBot/SyntaxMethods
Rubocop: FactoryBot/SyntaxMethods
2026-04-23 22:29:24 +09:30

38 lines
931 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe "comments/new" do
before do
controller.stub(:current_user) { nil }
@post = create(:post, body: 'tena koutou ki te ao')
@comment = create(:comment, commentable: @post)
assign(:comment, @comment)
assign(:comments, [@comment])
assign(:commentable, @post)
render
end
it "shows the text of the post under discussion" do
expect(rendered).to have_content @post.body
end
it "shows previous comments" do
expect(rendered).to have_content @comment.body
end
it "shows the correct comment count" do
expect(rendered).to have_content "1 comment"
end
it "renders new comment form" do
assert_select "form", action: comments_path, method: "post" do
assert_select "textarea#comment_body", name: "comment[body]"
end
end
it 'shows markdown help' do
expect(rendered).to have_content 'Markdown'
end
end