docbrown/spec/features/user_edits_a_comment_spec.rb
Mac Siri 5287d4a03b Create DelayedJob config and misc DX changes (#979)
* Change from #after_save to #after_create

* Update .babelrc

* Update cloud_name for test

* Update SlackBot's RssReader channel

* Update helpful-hints.md

* Create .gitdocs.json

* Remove serve-docs script

* Update docs/helpful-hints.md

* Update approval

* Revert "Change from #after_save to #after_create"

This reverts commit 548ee0d2c0d56a1aa67316468f4106ac9f437662.

* Create delayed_job.rb

* Bump ancestry gem to 3.0.3

* Fix broken spec

* Remove manual Delayed::Job config in test

* Update spec_helper.rb

* Fix broken specs

* Mute SlackBot in test

* Remove weekly-dgiest.yml

* Create PodcastEpisodeDecorator
2018-10-26 13:15:14 -04:00

36 lines
943 B
Ruby

require "rails_helper"
RSpec.describe "Editing A Comment", type: :feature, js: true do
let(:user) { create(:user) }
let(:article) { create(:article, show_comments: true) }
let(:new_comment_text) { Faker::Lorem.paragraph }
before do
create(:comment, commentable: article, user: user, body_markdown: Faker::Lorem.paragraph)
sign_in user
end
def assert_updated
expect(page).to have_css("textarea[autofocus='autofocus']")
fill_in "text-area", with: new_comment_text
click_button("SUBMIT")
expect(page).to have_text(new_comment_text)
end
context "when user edits comment on the bottom of the article" do
it "updates" do
visit article.path.to_s
click_link("EDIT")
assert_updated
end
end
context "when user edits via permalinks" do
it "updates" do
user.reload
visit user.comments.last.path.to_s
click_link("EDIT")
assert_updated
end
end
end