Skip to content
This repository has been archived by the owner on Jan 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #24 from ninech/fix-abscence-overview-crash
Browse files Browse the repository at this point in the history
Fix crash of abscence overview without a year set
  • Loading branch information
luxflux committed Jun 26, 2014
2 parents 91c09bd + 1938d9d commit 070e3a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/reports/absence_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def show
end

def calendar
@year ||= Time.now.year
if @month.nil?
@range = UberZeit.year_as_range(@year)
else
Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/reports/absence_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
get :calendar, team_id: nil, month: nil, year: 2013
assigns(:range).should eq(UberZeit.year_as_range(2013))
end

context 'without a year set' do
it 'assigns the current year as range' do
get :calendar, team_id: nil
assigns(:range).should eq(UberZeit.year_as_range(Time.now.year))
end
end
end

describe 'special rights' do
Expand Down

0 comments on commit 070e3a1

Please sign in to comment.