docbrown/spec/features/user_edits_a_comment_spec.rb
Mac Siri 1555388f12 Migrate to Travis CI --skip-ci (#588)
* Create .travis.yml

* Update .travis.yml

* Add postgresql to travis

* Change travis's postgresql version

* Add chrome addon to travis

* Adjust travis config --skip-ci

* Change travis dist

* Change travis to use Chrome --skip-ci

* Use IntegraitonHelpers --skip-ci

* Add no-sandbox option to headless chrome

* Add sudo to travis

* Fix broken spec

* Update travis.yml

* Change how travis store bundler cache

* Update chromedriver command

* Add CodeClimate to travis --skip-ci

* Remove deadcode --skip-ci

* Remove dead code

* Change rspec-retry back to 3

* Add deploy script to travis

* Safelist only master for Travis --skip-ci
2018-07-16 17:11:42 -04:00

40 lines
1.4 KiB
Ruby

require "rails_helper"
RSpec.describe "Editing Comment", type: :feature, js: true do
let(:user) { create(:user) }
let(:article) { create(:article, show_comments: true) }
let(:raw_comment) { Faker::Lorem.paragraph }
let(:new_comment_text) { Faker::Lorem.paragraph }
let(:comment) do
create(:comment, commentable_id: article.id, user_id: user.id, body_markdown: raw_comment)
end
before do
sign_in user
comment
end
describe "User edits their own comment on the bottom of the article" do
it "User clicks the edit button and autofocuses to the text field" do
visit article.path.to_s
find(:xpath, "//a[@class='edit-butt' and text()='EDIT']").click
expect(page).to have_css("textarea[autofocus='autofocus']")
end
it "User submits a new edit on their comment" do
visit article.path.to_s
find(:xpath, "//a[@class='edit-butt' and text()='EDIT']").click
fill_in "text-area", with: new_comment_text
click_button("SUBMIT")
expect(page).to have_text(new_comment_text)
end
end
describe "User edits comment their own comment on their permalink page" do
it "User clicks the edit button and autofocuses to the text field" do
visit comment.path.to_s
find(:xpath, "//a[@class='edit-butt' and text()='EDIT']").click
expect(page).to have_css("textarea[autofocus='autofocus']")
end
end
end