Skip to content

Commit 93d16a5

Browse files
author
Austin Schneider
committed
bug fix: allow from_param to take options
1 parent ac1653a commit 93d16a5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/cal/monthly_calendar.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ def from_month(month, options = {})
2222
new month.year, month.number, options
2323
end
2424

25-
def from_param(param)
25+
def from_param(param, options = {})
2626
year, month_number = if param.present?
2727
param.split '-'
2828
else
2929
now = Date.current
3030
[now.year, now.month]
3131
end
32-
new year, month_number
32+
new year, month_number, options
3333
end
3434
end
3535

lib/cal/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Cal
22

3-
VERSION = "0.5.0"
3+
VERSION = "0.5.1"
44

55
end

spec/cal/monthly_calendar_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
describe "from_month" do
99
it "returns a calendar for the month's year and month number" do
10-
subject.from_month(Cal::Month.new(2012, 11)).should == subject.new(2012, 11)
10+
subject.from_month(Cal::Month.new(2012, 11), :start_week_on => :tuesday).should == subject.new(2012, 11, :start_week_on => :tuesday)
1111
end
1212

1313
it "raises an error without something that can be converted to a month" do
@@ -19,8 +19,8 @@
1919

2020
describe "from_param" do
2121
it "is the calendar for the given param" do
22-
calendar = subject.new 2012, 5
23-
subject.from_param(calendar.to_param).should == calendar
22+
calendar = subject.new 2012, 5, :start_week_on => :tuesday
23+
subject.from_param(calendar.to_param, :start_week_on => :tuesday).should == calendar
2424
end
2525

2626
context "with a blank param" do

0 commit comments

Comments
 (0)