Sha256: c2b2b411626c6ea777b120f45a83e10cf7dc12be18ef77e2c6e506315ca741b8
Contents?: true
Size: 1.17 KB
Versions: 7
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
7 entries across 7 versions & 1 rubygems