Sha256: 7571d79a76737103785f3bfd8dca08a14a636645a905cdee165d8405d992f3e2
Contents?: true
Size: 1.17 KB
Versions: 20
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Proposals module Admin describe ProposalAnswerForm do let(:organization) { create(:organization) } let(:state) { "accepted" } let(:answer) { Decidim::Faker::Localized.sentence(3) } let(:params) do { state: state, answer: answer } end let(:form) do described_class.from_params(params).with_context( current_organization: organization ) end subject { form } context "when everything is OK" do it { is_expected.to be_valid } end context "when the state is not valid" do let(:state) { "foo" } it { is_expected.to be_invalid } end context "when there's no state" do let(:state) { nil } it { is_expected.to be_invalid } end context "rejecting a proposal" do let(:state) { "rejected" } context "when there's no answer" do let(:answer) { nil } it { is_expected.to be_invalid } end end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems