Sha256: 6be4393905caa26ad5d24429d4a4461675940c268be876fa2ecd3629a1ed63b5

Contents?: true

Size: 853 Bytes

Versions: 18

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples_for "authorable" do
  describe "validations" do
    context "when the user group is not verified" do
      it "is not valid" do
        user_group = create(:user_group)
        create(:user_group_membership, user: subject.author, user_group:)
        subject.user_group = user_group
        expect(subject).not_to be_valid
      end
    end

    context "when the author does not have a membership of the user group" do
      it "is not valid" do
        user_group = create(:user_group, :verified)
        subject.user_group = user_group
        expect(subject).not_to be_valid
      end
    end

    context "when the author is from another organization" do
      before do
        subject.author = create(:user)
      end

      it { is_expected.to be_invalid }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
decidim-core-0.30.0.rc3 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.30.0.rc2 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.30.0.rc1 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.2 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.5 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.1 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.4 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.0 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.3 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.0.rc4 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.0.rc3 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.0.rc2 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.29.0.rc1 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.2 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.1 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.0 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.0.rc5 lib/decidim/core/test/shared_examples/authorable.rb
decidim-core-0.28.0.rc4 lib/decidim/core/test/shared_examples/authorable.rb