aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_holidays_controller_spec.rb
blob: b3b813790794785e8a8d5a756318d149057eda12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'

describe AdminHolidaysController do

    describe :index do

        before do
            @holiday_one = FactoryGirl.create(:holiday, :day => Date.new(2010, 1, 1))
            @holiday_two = FactoryGirl.create(:holiday, :day => Date.new(2011, 2, 2))
            @holiday_three = FactoryGirl.create(:holiday, :day => Date.new(2011, 3, 3))
        end

        it 'gets a hash of holidays keyed by year' do
           get :index
           assigns(:holidays_by_year)[2010].should include(@holiday_one)
           assigns(:holidays_by_year)[2011].should include(@holiday_two)
           assigns(:holidays_by_year)[2011].should include(@holiday_three)
        end

        it 'gets a list of years with holidays' do
            get :index
            assigns(:years).should include(2010)
            assigns(:years).should include(2011)
        end

        it 'renders the index template' do
           get :index
           expect(response).to render_template('index')
        end

    end
end