Sha256: f727a79735f41693f3b06e3e6af0ea077dd8a0583a155b1fdb916373bcb006df

Contents?: true

Size: 1.26 KB

Versions: 23

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples "scope helpers" do
  describe Decidim::ScopesHelper do
    let(:organization) { create(:organization) }
    let(:scopes_enabled) { true }
    let(:participatory_space_scope) { nil }
    let(:feature) { create(:feature, manifest_name: "dummy", participatory_space: participatory_space) }
    let(:scope) { create(:scope, organization: organization) }
    let(:resource) { create(:dummy_resource, feature: feature, scope: scope) }

    subject { helper.has_visible_scopes?(resource) }

    before do
      allow(helper).to receive(:current_participatory_space).and_return(participatory_space)
    end

    describe "has_visible_scopes?" do
      context "when all conditions are met" do
        it { is_expected.to be_truthy }
      end

      context "when the process has not scope enabled" do
        let(:scopes_enabled) { false }
        it { is_expected.to be_falsey }
      end

      context "when the process has a scope" do
        let(:participatory_space_scope) { create(:scope, organization: organization) }
        it { is_expected.to be_falsey }
      end

      context "when the resource has not a scope" do
        let(:scope) { nil }
        it { is_expected.to be_falsey }
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
decidim-core-0.7.4 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.7.3 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.7.2 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.7.1 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.7.0 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.8 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.8 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.7 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.7 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.6 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.6 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.5 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.5 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.4 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.4 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.3 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.3 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.2 lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-0.6.2 decidim-core/lib/decidim/core/test/shared_examples/scope_helper_examples.rb
decidim-core-0.6.1 lib/decidim/core/test/shared_examples/scope_helper_examples.rb