Sha256: 51fd0782b9d813fdc3443232641d7b8fe785ca9fa8f77023913c8ad30847cf58

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

require 'rails_helper'

module Mks
  module Auth
    RSpec.describe UsersController, type: :controller do
      routes { Mks::Auth::Engine.routes }

      describe 'GET #roles' do
        it 'gets roles of a user' do
          u = create(:user)
          roles = [create(:user_role), create(:user_role)]
          u.roles << roles
          get :roles, session: { user_id: u.id }
          result = JSON(response.body)
          expect(result['data'].count).to eq 2
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mks_auth-1.4.0 spec/controllers/mks/auth/users_controller_spec.rb
mks_auth-1.2.0 spec/controllers/mks/auth/users_controller_spec.rb
mks_auth-1.0.0 spec/controllers/mks/auth/users_controller_spec.rb