Sha256: 295f8dae5391918741cf0c9049a4eb03fef7b7b8f46022d1b497eb1fd3b5966b

Contents?: true

Size: 1.53 KB

Versions: 23

Compression:

Stored size: 1.53 KB

Contents

require 'rails_helper'

module MnoEnterprise
  describe Jpi::V1::Admin::AuditEventsController, type: :controller do
    include MnoEnterprise::TestingSupport::JpiV1TestHelper
    render_views
    routes { MnoEnterprise::Engine.routes }
    before { request.env["HTTP_ACCEPT"] = 'application/json' }

    #===============================================
    # Assignments
    #===============================================
    # Stub controller ability
    # let!(:ability) { stub_ability }
    # before { allow(ability).to receive(:can?).with(any_args).and_return(true) }

    # # Stub user and user call
    let(:user) { FactoryGirl.build(:user, :admin) }
    before { api_stub_for(get: "/users/#{user.id}", response: from_api(user)) }
    # before { api_stub_for(get: '/users?filter%5Bemail%5D&limit=1', response: from_api(nil)) }

    before { sign_in user }

    let(:audit_event) { FactoryGirl.build(:audit_event) }
    before { api_stub_for(get: '/audit_events', response: from_api([audit_event]))}

    describe 'GET #index' do
      subject { get :index }

      # TODO it_behaves_like for admin
      # it_behaves_like 'jpi v1 protected action'

      it 'is successful' do
        subject
        expect(response).to be_success
      end

      context 'sucess' do
        it 'assigns @audit_events' do
          subject
          expect(assigns(:audit_events).to_a).to eq([audit_event])
        end

        it 'renders the :index view' do
          subject
          expect(response).to render_template :index
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mno-enterprise-api-3.1.4 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.7 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.9 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.1.3 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.6 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.8 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.1.2 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.5 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.7 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.6 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.5 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.1.1 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.4 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.4 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.1.0 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.3 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.3 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.2 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-2.0.2 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb
mno-enterprise-api-3.0.1 spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb