Sha256: 2cdad81f22777715067f98b1ce8b2557903c0ca22e2fa06faaebd80f684fb38f

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

describe StatusCat::StatusController do

  routes { StatusCat::Engine.routes }

  describe '#index' do

    it 'gets successfully' do
      get :index
      expect( response ).to be_success
    end

    it 'assigns @checkers to StatusCat::Status.all' do
      get :index

      @checkers = assigns[ :checkers ]
      expect( @checkers ).to_not be( nil )
      expect( @checkers.length ).to eql( StatusCat::Status.all.length )
      @checkers.each { |checker| expect( checker ).to be_a_kind_of( StatusCat::Checkers::Base ) }
    end

    it 'uses the configured before authentication filter' do
      allow( Rails.env ).to receive( :test? ).and_return( false )
      expect( controller  ).to receive( :authenticate! )
      expect( controller ).to receive( :authorize! )

      get :index
    end

    it 'renders with the configured layout' do
      get :index
      expect( response ).to render_template( StatusCat.config.layout )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
status_cat-0.1.1 spec/controllers/status_cat/status_controller_spec.rb