Sha256: ce41d271a7de0f9c892f6a6d300f146b61f76ff5fe46cef00b0629c914ab702c

Contents?: true

Size: 870 Bytes

Versions: 3

Compression:

Stored size: 870 Bytes

Contents

require_relative '../spec_helper'

describe NotificationsController do
  before :each do
    controller.stub(:load_section)
  end

  describe 'index action' do
    it 'should assigns notifications' do
      get :index
      assigns[:notifications].should_not be_nil
    end

    it 'should render template index' do
      get :index
      controller.should render_template('index')
    end
  end

  describe 'destroy action' do
    let(:id){ 33}
    let(:notification){ double() }

    before :each do
      Notification.stub(:find){ notification }
      notification.stub(:destroy)
    end

    it 'should call destroy on the notification' do
      notification.should_receive(:destroy)
      delete :destroy, id: id
    end

    it 'should redirect to action index' do
      delete :destroy, id: id
      controller.should redirect_to(action: :index)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis_monitor-0.3.3 lib/engine/spec/controllers/notifications_controller_spec.rb
redis_monitor-0.3.2 lib/engine/spec/controllers/notifications_controller_spec.rb
redis_monitor-0.3 lib/engine/spec/controllers/notifications_controller_spec.rb