Sha256: 301edb946f5c1bd2549acd2793533111f48de8f096e263616afa698888b7077e

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

RSpec.describe 'Subscription orders admin' do
  stub_authorization!

  let(:subscription) { create(:subscription, :with_shipping_address, :with_billing_address) }

  before do
    visit spree.edit_admin_subscription_path(subscription)
    within('.tabs') { click_link 'Orders' }
  end

  it 'shows a No orders messages' do
    expect(page).to have_css('legend', text: 'Orders')
    expect(page).to have_content(/No orders found/i)
  end

  context 'with some orders' do
    let(:orders) { build_list(:order, 3, subscription_order: true) }
    let(:subscription) do
      create(:subscription, :with_shipping_address, :with_billing_address).tap do |subscription|
        subscription.orders << orders
      end
    end

    it 'lists the orders of a subscription' do
      expect(page).to have_css('.admin_subscription_order', count: orders.size)
      within('#listing_subscription_orders') do
        orders.each do |order|
          expect(page).to have_content(order.number)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-2.0.1 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-2.0.0 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-1.1.0 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-1.0.1 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-1.0.0 spec/features/admin/subscription_orders_spec.rb
solidus_subscriptions-1.0.0.rc1 spec/features/admin/subscription_orders_spec.rb