Improve readability of report spec

This commit is contained in:
Maikel Linke
2020-05-14 10:36:10 +10:00
parent 3a46f32aa3
commit 359fd1ac98
2 changed files with 16 additions and 7 deletions

View File

@@ -226,7 +226,6 @@ Layout/LineLength:
- spec/lib/open_food_network/group_buy_report_spec.rb
- spec/lib/open_food_network/lettuce_share_report_spec.rb
- spec/lib/open_food_network/option_value_namer_spec.rb
- spec/lib/open_food_network/order_and_distributor_report_spec.rb
- spec/lib/open_food_network/order_cycle_form_applicator_spec.rb
- spec/lib/open_food_network/order_cycle_permissions_spec.rb
- spec/lib/open_food_network/order_grouper_spec.rb

View File

@@ -8,11 +8,16 @@ module OpenFoodNetwork
subject = OrderAndDistributorReport.new nil
header = subject.header
expect(header).to eq(['Order date', 'Order Id',
'Customer Name', 'Customer Email', 'Customer Phone', 'Customer City',
'SKU', 'Item name', 'Variant', 'Quantity', 'Max Quantity', 'Cost', 'Shipping Cost',
'Payment Method',
'Distributor', 'Distributor address', 'Distributor city', 'Distributor postcode', 'Shipping Method', 'Shipping instructions'])
expect(header).to eq(
[
'Order date', 'Order Id',
'Customer Name', 'Customer Email', 'Customer Phone', 'Customer City',
'SKU', 'Item name', 'Variant', 'Quantity', 'Max Quantity', 'Cost', 'Shipping Cost',
'Payment Method',
'Distributor', 'Distributor address', 'Distributor city', 'Distributor postcode',
'Shipping Method', 'Shipping instructions'
]
)
end
context 'with completed order' do
@@ -21,7 +26,12 @@ module OpenFoodNetwork
let(:product) { create(:product) }
let(:shipping_method) { create(:shipping_method) }
let(:shipping_instructions) { 'pick up on thursday please!' }
let(:order) { create(:order, state: 'complete', completed_at: Time.zone.now, distributor: distributor, bill_address: bill_address, special_instructions: shipping_instructions) }
let(:order) {
create(:order,
state: 'complete', completed_at: Time.zone.now,
distributor: distributor, bill_address: bill_address,
special_instructions: shipping_instructions)
}
let(:payment_method) { create(:payment_method, distributors: [distributor]) }
let(:payment) { create(:payment, payment_method: payment_method, order: order) }
let(:line_item) { create(:line_item_with_shipment, product: product, order: order) }