diff options
Diffstat (limited to 'spec/controllers/admin_holidays_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin_holidays_controller_spec.rb | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/spec/controllers/admin_holidays_controller_spec.rb b/spec/controllers/admin_holidays_controller_spec.rb index 56d6041ca..1f76a7fcb 100644 --- a/spec/controllers/admin_holidays_controller_spec.rb +++ b/spec/controllers/admin_holidays_controller_spec.rb @@ -32,12 +32,22 @@ describe AdminHolidaysController do describe :new do - before do - get :new + + describe 'when not using ajax' do + + it 'renders the new template' do + get :new + expect(response).to render_template('new') + end + end - it 'renders the new template' do - expect(response).to render_template('new') + describe 'when using ajax' do + + it 'renders the new form partial' do + xhr :get, :new + expect(response).to render_template('new_form') + end end it 'creates a new holiday' do @@ -88,14 +98,28 @@ describe AdminHolidaysController do before do @holiday = FactoryGirl.create(:holiday) - get :edit, :id => @holiday.id end - it 'renders the edit template' do - expect(response).to render_template('edit') + describe 'when not using ajax' do + + it 'renders the edit template' do + get :edit, :id => @holiday.id + expect(response).to render_template('edit') + end + + end + + describe 'when using ajax' do + + it 'renders the edit form partial' do + xhr :get, :edit, :id => @holiday.id + expect(response).to render_template('edit_form') + end + end it 'gets the holiday in the id param' do + get :edit, :id => @holiday.id assigns[:holiday].should == @holiday end |