adds validation on feasible_explanation
This commit is contained in:
@@ -16,6 +16,7 @@ class SpendingProposal < ActiveRecord::Base
|
||||
validates :title, presence: true
|
||||
validates :author, presence: true
|
||||
validates :description, presence: true
|
||||
validates_presence_of :feasible_explanation, if: :valuation_finished?
|
||||
|
||||
validates :title, length: { in: 4..SpendingProposal.title_max_length }
|
||||
validates :description, length: { maximum: SpendingProposal.description_max_length }
|
||||
|
||||
@@ -42,6 +42,18 @@ describe SpendingProposal do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#feasible_explanation" do
|
||||
it "should be valid if valuation not finished" do
|
||||
spending_proposal.valuation_finished = false
|
||||
expect(spending_proposal).to be_valid
|
||||
end
|
||||
|
||||
it "should not be valid if valuation finished" do
|
||||
spending_proposal.valuation_finished = true
|
||||
expect(spending_proposal).to_not be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe "dossier info" do
|
||||
describe "#feasibility" do
|
||||
it "can be feasible" do
|
||||
|
||||
Reference in New Issue
Block a user