Sha256: 24dbe6255c2275ee7242de1f33e3adbfb7a3ce34214576d9fdcd03e90da96a6d

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

require 'rails_helper'
require 'cancan/matchers'

# TODO: add more ability tests
RSpec.describe MnoEnterprise::Ability, type: :model do
  subject(:ability) { described_class.new(user) }
  let(:user) { FactoryGirl.build(:user, admin_role: admin_role) }
  let(:admin_role) { nil }
  let(:organization) { FactoryGirl.build(:organization) }

  before { allow(user).to receive(:role).with(organization) { nil } }

  context 'when User#admin_role is admin' do
    let(:admin_role) { 'admin' }
    it { is_expected.to be_able_to(:manage_app_instances, organization) }
  end

  context 'when no User#admin_role' do
    it { is_expected.not_to be_able_to(:manage_app_instances, organization) }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mno-enterprise-core-3.2.1 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.2.0 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.1.4 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.1.3 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.1.2 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.1.1 spec/models/mno_enterprise/ability_spec.rb
mno-enterprise-core-3.1.0 spec/models/mno_enterprise/ability_spec.rb