changes the responsible_name from username to document_number
This commit is contained in:
@@ -123,7 +123,7 @@ class SpendingProposal < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def set_responsible_name
|
||||
self.responsible_name = author.try(:username)
|
||||
self.responsible_name = author.try(:document_number)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -262,10 +262,10 @@ describe SpendingProposal do
|
||||
end
|
||||
|
||||
describe "responsible_name" do
|
||||
it "gets updated with the user name" do
|
||||
u = create(:user, username: "manolo")
|
||||
it "gets updated with the document_number" do
|
||||
u = create(:user, document_number: "123456")
|
||||
sp = create(:spending_proposal, author: u)
|
||||
expect(sp.responsible_name).to eq("manolo")
|
||||
expect(sp.responsible_name).to eq("123456")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user