Files
growstuff/spec/features/comments/commenting_a_comment_spec.rb
Brenda Wallace 34b399cd8e Use more signed in contexts in browse crops spec
More member role contexts on alt name spec

More member role contexts in crop feature specs

Don't wrap the shared_context
2019-08-18 16:10:03 +12:00

33 lines
971 B
Ruby

require 'rails_helper'
describe 'Commenting on a post' do
include_context 'signed in member'
let(:member) { create :member }
let(:post) { create :post, author: member }
before { visit new_comment_path post_id: post.id }
it "creating a comment" do
fill_in "comment_body", with: "This is a sample test for comment"
click_button "Post comment"
expect(page).to have_content "comment was successfully created."
expect(page).to have_content "Posted by"
Percy.snapshot(page, name: 'Posting a comment')
end
context "editing a comment" do
let(:existing_comment) { create :comment, post: post, author: member }
before do
visit edit_comment_path existing_comment
end
it "saving edit" do
fill_in "comment_body", with: "Testing edit for comment"
click_button "Post comment"
expect(page).to have_content "comment was successfully updated."
expect(page).to have_content "edited at"
end
end
end