Sha256: e144351dcb3af9fe0a3cadb36277964b21361b2764d9734d390e76106a9f5fbf

Contents?: true

Size: 908 Bytes

Versions: 17

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

shared_examples "an amendment form" do
  let(:title) { "More sidewalks and less roads!" }
  let(:body) { "Everything would be better" }
  let(:emendation_params) do
    {
      title:,
      body:
    }
  end

  context "when everything is OK" do
    it { is_expected.to be_valid }
  end

  context "when there is no title" do
    let(:title) { nil }

    it { is_expected.to be_invalid }

    it "only adds errors to this field" do
      subject.valid?
      expect(subject.errors.attribute_names).to eq [:title]
    end
  end

  context "when the title is too long" do
    let(:body) { "A" * 200 }

    it { is_expected.to be_invalid }
  end

  context "when the body is not etiquette-compliant" do
    let(:body) { "A" }

    it { is_expected.to be_invalid }
  end

  context "when there is no body" do
    let(:body) { nil }

    it { is_expected.to be_invalid }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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