Sha256: 9d71cb6dace7abf6acefdf1157a9420274b116a13b93b5e896c2219ce621fdc6

Contents?: true

Size: 781 Bytes

Versions: 7

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SolidusSubscriptions::PermissionSets::SubscriptionManagement do
  it 'is allowed to manage all subscriptions' do
    user = create(:user)
    subscription = create(:subscription)

    ability = Spree::Ability.new(user)
    permission_set = described_class.new(ability)
    permission_set.activate!

    expect(ability).to be_able_to(:manage, subscription)
  end

  it "is allowed to manage all line items" do
    user = create(:user)
    subscription = create(:subscription)
    line_item = create(:subscription_line_item, subscription: subscription)

    ability = Spree::Ability.new(user)
    permission_set = described_class.new(ability)
    permission_set.activate!

    expect(ability).to be_able_to(:manage, line_item)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-2.0.1 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-2.0.0 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-1.1.0 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-1.0.1 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-1.0.0 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb
solidus_subscriptions-1.0.0.rc1 spec/lib/solidus_subscriptions/permission_sets/subscription_management_spec.rb