-
Notifications
You must be signed in to change notification settings - Fork 54
[Delivers #102267428] pick highest pending approver on the stack #650
Changes from all commits
335f97b
bf1170c
1aa3fee
98fbfb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -453,4 +453,19 @@ | |
expect(wo.building_id).to be_nil | ||
end | ||
end | ||
|
||
describe "#current_approver_email_address" do | ||
it "returns the first pending approval's email address" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when you say |
||
wo = FactoryGirl.create(:ncr_work_order, :with_approvers) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be outside the scope of this PR, but what do you think about include FactoryGirl syntax methods so this can just be https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#configure-your-test-suite |
||
expect(wo.current_approver_email_address).to eq(wo.individual_approvals.first.user.email_address) | ||
wo.individual_approvals.first.approve! | ||
expect(wo.current_approver_email_address).to eq(wo.individual_approvals.last.user.email_address) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a newline between tests? |
||
it "returns the first approver when fully approved" do | ||
wo = FactoryGirl.create(:ncr_work_order, :with_approvers) | ||
wo.individual_approvals.first.approve! | ||
wo.reload.individual_approvals.last.approve! | ||
expect(wo.current_approver_email_address).to eq(wo.individual_approvals.first.user.email_address) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about not having a comment here? I think this method's tests make it clear why it works this way, and having the comment could lead to more complications down the line.
For more details on this line of thinking, this is a killer blog post on why code comments can be tricky https://robots.thoughtbot.com/letting-your-code-speak-for-itself by the one and only @adarsh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:thumbs_up:
On Monday, October 5, 2015, Jessie A. Young notifications@github.com
wrote:
@adarshp http://www.twitter.com/adarshp
313.454.1515 (mobile)
See when I am free: http://bit.ly/adarshcal