Sha256: 8b030ab2ce83b529c500416593d9ee624f5a2fa8513ed74796a0769ac9cde0c7

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Results
    describe Result do
      let(:result) { build :result }
      subject { result }

      it { is_expected.to be_valid }

      include_examples "has feature"
      include_examples "has scope"
      include_examples "has category"
      include_examples "has reference"

      describe "#users_to_notify_on_comment_created" do
        let!(:follows) { create_list(:follow, 3, followable: subject) }
        let(:followers) { follows.map(&:user) }
        let(:participatory_space) { subject.feature.participatory_space }
        let(:organization) { participatory_space.organization }
        let!(:participatory_process_admin) do
          user = create(:user, :confirmed, organization: organization)
          Decidim::ParticipatoryProcessUserRole.create!(
            role: :admin,
            user: user,
            participatory_process: participatory_space
          )
          user
        end

        it "returns the followers and the feature's participatory space admins" do
          expect(subject.users_to_notify_on_comment_created).to match_array(followers.concat([participatory_process_admin]))
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-results/spec/models/result_spec.rb
decidim-0.6.7 decidim-results/spec/models/result_spec.rb
decidim-0.6.6 decidim-results/spec/models/result_spec.rb
decidim-0.6.5 decidim-results/spec/models/result_spec.rb
decidim-0.6.4 decidim-results/spec/models/result_spec.rb
decidim-0.6.3 decidim-results/spec/models/result_spec.rb
decidim-0.6.2 decidim-results/spec/models/result_spec.rb
decidim-0.6.1 decidim-results/spec/models/result_spec.rb
decidim-0.6.0 decidim-results/spec/models/result_spec.rb