Sha256: 5def98c58310970d64a36fc4df879a95eac9263b461575808b0de6153cadffa8

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe "Comment notifications", type: :feature do
  let!(:organization) { create(:organization) }
  let!(:feature) { create(:feature, manifest_name: :dummy, organization: organization) }
  let!(:user) { create(:user, :confirmed, organization: organization) }
  let!(:commentable) { create(:dummy_resource, feature: feature) }
  let!(:comments) { create_list(:comment, 3, commentable: commentable) }

  before do
    switch_to_host(organization.host)
    login_as user, scope: :user
  end

  it "commentable author receives an email with a link to the comment", perform_enqueued: true do
    visit resource_locator(commentable).path
    expect(page).to have_selector(".add-comment form")

    within ".add-comment form" do
      fill_in "add-comment-#{commentable.class.name}-#{commentable.id}", with: "This is a new comment"
      click_button "Send"
    end

    expect(page).to have_comment_from(user, "This is a new comment")

    wait_for_email subject: "a new comment"

    relogin_as commentable.author, scope: :user

    visit last_email_first_link

    expect(page).to have_comment_from(user, "This is a new comment")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-0.5.1 decidim-comments/spec/features/notifications_spec.rb
decidim-0.5.0 decidim-comments/spec/features/notifications_spec.rb