Sha256: a32ba862703df80d3f90e4c8d37daa2140966841e0bcaadccf3adab61fe3603c

Contents?: true

Size: 906 Bytes

Versions: 41

Compression:

Stored size: 906 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: title,
      body: body
    }
  end

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

  context "when there's 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.keys).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's no body" do
    let(:body) { nil }

    it { is_expected.to be_invalid }
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.1 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.0 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.0.rc2 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.26.0.rc1 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.2 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.1 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.0 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.0.rc4 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.0.rc3 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.0.rc2 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.25.0.rc1 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb
decidim-core-0.24.3 lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb