adds responsible name to proposals

This commit is contained in:
rgarcia
2015-09-14 16:43:32 +02:00
parent 47ebc41c69
commit e9e339fa50
10 changed files with 128 additions and 7 deletions

View File

@@ -12,13 +12,13 @@ describe Proposal do
expect(proposal).to_not be_valid
end
it "should not be valid without a question" do
proposal.question = nil
it "should not be valid without a title" do
proposal.title = nil
expect(proposal).to_not be_valid
end
it "should not be valid without a title" do
proposal.title = nil
it "should not be valid without a question" do
proposal.question = nil
expect(proposal).to_not be_valid
end
@@ -35,6 +35,31 @@ describe Proposal do
end
end
describe "#responsible" do
it "should be mandatory" do
proposal.responsible_name = nil
expect(proposal).to_not be_valid
end
it "should be the document_number if level two user" do
author = create(:user, :level_two, document_number: "12345678Z")
proposal.author = author
proposal.responsible_name = nil
expect(proposal).to be_valid
proposal.responsible_name = "12345678Z"
end
it "should be the document_number if level two user" do
author = create(:user, :level_three, document_number: "12345678Z")
proposal.author = author
proposal.responsible_name = nil
expect(proposal).to be_valid
proposal.responsible_name = "12345678Z"
end
end
it "should sanitize the tag list" do
proposal.tag_list = "user_id=1"
proposal.valid?