Sha256: 3f1e27db70b16e4b98bc3156e480bf5b4721b40859472dca869b25d17802b576

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true
require "spec_helper"

module Decidim
  module Admin
    describe NewsletterForm do
      let(:organization) { create(:organization) }
      let(:newsletter_subject) do
        {
          en: "Subject",
          es: "Asunto",
          ca: "Assumpte"
        }
      end

      let(:body) do
        {
          en: "Body",
          es: "Cuerpo",
          ca: "Cos"
        }
      end

      subject do
        described_class.new(subject: newsletter_subject, body: body)
                       .with_context(current_organization: organization)
      end

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

      context "when there's no subject" do
        let(:newsletter_subject) { nil }

        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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-admin/spec/forms/newsletter_form_spec.rb