Sha256: cc4d10759177bfe5d7638841ec5439841751dc47d73a3d3efb3b19f88bed3e6d

Contents?: true

Size: 818 Bytes

Versions: 11

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::AttachmentForm do
  let(:title) { "My attachment" }
  let(:file) { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }

  subject do
    described_class.new(
      title: title,
      file: file
    )
  end

  context "with correct data" do
    it "is valid" do
      expect(subject).to be_valid
    end
  end

  context "when the file is present" do
    context "and the title is not present" do
      let(:title) { "" }

      it "is not valid" do
        expect(subject).not_to be_valid
      end
    end
  end

  context "when the file is not present" do
    let(:file) { nil }

    context "and the title is not present" do
      let(:title) { "" }

      it "is not valid" do
        expect(subject).to be_valid
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.7 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.6 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.5 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.4 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.3 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.2 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.1 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.6.0 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.5.1 decidim-core/spec/forms/attachment_form_spec.rb
decidim-0.5.0 decidim-core/spec/forms/attachment_form_spec.rb