* 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
45 lines
1.4 KiB
Ruby
45 lines
1.4 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Creating Comment", type: :feature, js: true do
|
|
let(:user) { create(:user) }
|
|
let(:raw_comment) { Faker::Lorem.paragraph }
|
|
let(:article) do
|
|
create(:article, user_id: user.id, show_comments: true)
|
|
end
|
|
|
|
before do
|
|
sign_in user
|
|
end
|
|
|
|
it "User fills out comment box normally" do
|
|
visit article.path.to_s
|
|
fill_in "text-area", with: raw_comment
|
|
find(".checkbox").click
|
|
click_button("SUBMIT")
|
|
expect(page).to have_text(raw_comment)
|
|
end
|
|
|
|
it "User fill out commen box then click previews and submit" do
|
|
visit article.path.to_s
|
|
fill_in "text-area", with: raw_comment
|
|
find(".checkbox").click
|
|
click_button("PREVIEW")
|
|
|
|
expect(page).to have_text(raw_comment)
|
|
expect(page).to have_text("MARKDOWN")
|
|
click_button("MARKDOWN")
|
|
# expect(page).to have_text(raw_comment)
|
|
expect(page).to have_text("PREVIEW")
|
|
click_button("SUBMIT")
|
|
expect(page).to have_text(raw_comment)
|
|
end
|
|
|
|
it "User replies to a comment" do
|
|
create(:comment, commentable_id: article.id, user_id: user.id)
|
|
visit article.path.to_s
|
|
find(".toggle-reply-form").click
|
|
find(:xpath, "//div[@class='actions']/form[@class='new_comment']/textarea").set(raw_comment)
|
|
find(:xpath, "//div[contains(@class, 'reply-actions')]/input[@name='commit']").click
|
|
expect(page).to have_text(raw_comment)
|
|
end
|
|
end
|