Sha256: c5bd975365bbee7bb1add121db53b12141d5e84b8383363ec90c9b0613b13d3f

Contents?: true

Size: 1.47 KB

Versions: 9

Compression:

Stored size: 1.47 KB

Contents

RSpec.feature 'Admin Permissions', type: :feature do
  context 'orders' do
    background do
      user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
      Spree::Ability.register_ability(AbilityDecorator)
      visit spree.login_path

      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button login_button
    end

    context 'admin is restricted from accessing orders' do
      scenario 'can not list orders' do
        visit spree.admin_orders_path
        expect(page).to have_text 'Authorization Failure'
      end

      scenario 'can not edit orders' do
        create(:order, number: 'R123')
        visit spree.edit_admin_order_path('R123')
        expect(page).to have_text 'Authorization Failure'
      end

      scenario 'can not new orders' do
        visit spree.new_admin_order_path
        expect(page).to have_text 'Authorization Failure'
      end
    end

    context "admin is restricted from accessing an order's customer details" do
      given(:order) { create(:order_with_totals) }

      scenario 'can not list customer details for an order' do
        visit spree.admin_order_customer_path(order)
        expect(page).to have_text 'Authorization Failure'
      end

      scenario "can not edit an order's customer details" do
        visit spree.edit_admin_order_customer_path(order)
        expect(page).to have_text 'Authorization Failure'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_auth_devise-4.6.3 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.6.2 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.6.1 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.6.0 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.5.0 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.4.2 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.4.1 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.4.0 spec/features/admin_permissions_spec.rb
spree_auth_devise-4.3.4 spec/features/admin_permissions_spec.rb