Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f716077
commit e49b86a
Showing
5 changed files
with
38 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require_relative "../lib/time_budget/presenters/activity" | ||
|
||
describe TimeBudget::Presenters::Activity do | ||
it "delegates the title to the supplied activity" do | ||
TimeBudget::Presenters::Activity.new(stub(title: "foo")).title.should == "foo" | ||
end | ||
|
||
it "delegates the duration to the supplied activity" do | ||
TimeBudget::Presenters::Activity.new(stub(duration: 99)).duration.should == 99 | ||
end | ||
|
||
it "displaying hours and minutes of the duration" do | ||
TimeBudget::Presenters::Activity.new(stub(duration: (60*60)+(60*30))).hours_and_minutes.should == "1:30" | ||
end | ||
|
||
context "when displaying the duration" do | ||
it "displays the hours of the duration" do | ||
TimeBudget::Presenters::Activity.new(stub("activity", duration: (60*60*12)+(60*30))).hours.should == "12" | ||
end | ||
|
||
it "pads the hours with one zero if the value is a single digit" do | ||
TimeBudget::Presenters::Activity.new(stub("activity", duration: (60*60)+(60*30))).hours.should == "01" | ||
end | ||
|
||
it "displays the minutes of the duration" do | ||
TimeBudget::Presenters::Activity.new(stub("activity", duration: (60*60*12)+(60*30))).minutes.should == "30" | ||
end | ||
|
||
it "pads the minutes with one zero if the value is a single digit" do | ||
TimeBudget::Presenters::Activity.new(stub("activity", duration: (60*60*12)+(60*2))).minutes.should == "02" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters