Sha256: 98d4751385a6db8930ef8edb333aaad3dce9111083ecc8390461ceb8660cc12d

Contents?: true

Size: 767 Bytes

Versions: 3

Compression:

Stored size: 767 Bytes

Contents

require 'spec_helper'

describe BaseController do
  before :each do
    @context = double(:context)
    @controller = BaseController.new(context: @context)
  end

  describe 'execute method' do
    it 'should not raise error if the action executed raised RedisNotAvailable' do
      @controller.stub(:action) { raise RedisNotAvailable }
      @controller.should_receive(:redis_not_available)
      expect{ @controller.execute(:action) }.not_to raise_error
    end
  end

  describe 'redis_not_available method' do
    it 'should render redis not available error page' do
      Backend.stub(:host)
      Backend.stub(:port)
      @context.should_receive(:haml).with('errors/redis_not_available'.to_sym, anything)
      @controller.redis_not_available
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis_monitor-0.0.5 spec/controllers/base_controller_spec.rb
redis_monitor-0.0.4 spec/controllers/base_controller_spec.rb
redis_monitor-0.0.3 spec/controllers/base_controller_spec.rb