Skip to content

Commit

Permalink
Make 'name' argument optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ineu committed Mar 9, 2021
1 parent fc9d4b8 commit d7a4535
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/business/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def self.load_cached(calendar)

attr_reader :name, :holidays, :working_days, :extra_working_dates

def initialize(name:, extra_working_dates: nil, working_days: nil, holidays: nil)
def initialize(name: nil, extra_working_dates: nil, working_days: nil, holidays: nil)
@name = name
set_extra_working_dates(extra_working_dates)
set_working_days(working_days)
Expand Down
10 changes: 10 additions & 0 deletions spec/business/calendar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
end
end

describe ".new" do
it "allows to set optional name" do
instance = described_class.new
expect(instance.name).to eq nil

instance = described_class.new(name: "foo")
expect(instance.name).to eq "foo"
end
end

describe "#set_working_days" do
subject(:set_working_days) { calendar.set_working_days(working_days) }

Expand Down

0 comments on commit d7a4535

Please sign in to comment.