adds responsible name to proposals
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user