Sha256: fe72baee814630a8b313e964ac24a4a5d463ca2d82f88ca7dcfe44dd01d21688

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

describe StatusCat::StatusController do

  routes { StatusCat::Engine.routes }

  describe '#index' do

    it 'gets successfully' do
      get :index
      expect(response).to be_successful
    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

2 entries across 2 versions & 1 rubygems

Version Path
status_cat-5.2.1 spec/controllers/status_cat/status_controller_spec.rb
status_cat-5.2.0 spec/controllers/status_cat/status_controller_spec.rb