Sha256: 7d6489d7c4a1c1dd1902858a52e3b7b18394b60c07286b90fa404870a4dafea3

Contents?: true

Size: 1.65 KB

Versions: 21

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

shared_examples "amendment rejected event" do
  include_context "when a simple event"

  let(:resource) { emendation }
  let(:event_name) { "decidim.events.amendments.amendment_rejected" }

  it_behaves_like "a simple event"

  let(:emendation_author_nickname) { "@#{emendation.creator_author.nickname}" }
  let(:emendation_path) { Decidim::ResourceLocatorPresenter.new(emendation).path }
  let(:emendation_author_path) { Decidim::UserPresenter.new(emendation.creator_author).profile_path }
  let(:amendable_path) { Decidim::ResourceLocatorPresenter.new(amendable).path }

  describe "email_subject" do
    it "is generated correctly" do
      expect(subject.email_subject).to eq("Amendment rejected for #{amendable_title} from #{emendation_author_nickname}")
    end
  end

  describe "email_intro" do
    it "is generated correctly" do
      expect(subject.email_intro)
        .to eq("An amendment has been rejected for #{amendable_title}. You can see it from this page:")
    end
  end

  describe "email_outro" do
    it "is generated correctly" do
      expect(subject.email_outro)
        .to eq("You have received this notification because you are following #{amendable_title}. You can stop receiving notifications following the previous link.")
    end
  end

  describe "notification_title" do
    it "is generated correctly" do
      expect(subject.notification_title)
        .to eq("The <a href=\"#{emendation_path}\">amendment</a> created by <a href=\"#{emendation_author_path}\">#{emendation_author_nickname}</a> has been rejected for <a href=\"#{amendable_path}\">#{amendable_title}</a>.") # rubocop:disable Layout/LineLength
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-core-0.27.9 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.8 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.7 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.6 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.5 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.4 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.3 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.2 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.1 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.0 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.0.rc2 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.27.0.rc1 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb