mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update setup script for removed callbacks
We removed some Spree magic a while back and that broke our sample data script. This is now corrected. I also added a spec so that we will notice broken seed data earlier.
This commit is contained in:
@@ -31,6 +31,7 @@ module SampleData
|
||||
|
||||
log "- complete order - shipped"
|
||||
order = create_complete_order
|
||||
order.payments.first.amount = order.total
|
||||
order.payments.first.capture!
|
||||
order.save
|
||||
order.shipment.reload.ship!
|
||||
|
||||
26
spec/lib/tasks/sample_data_rake_spec.rb
Normal file
26
spec/lib/tasks/sample_data_rake_spec.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'rake'
|
||||
|
||||
describe 'sample_data.rake' do
|
||||
before(:all) do
|
||||
Rake.application.rake_require 'tasks/sample_data'
|
||||
Rake::Task.define_task(:environment)
|
||||
end
|
||||
|
||||
before do
|
||||
# Create seed data required by the sample data.
|
||||
create(:user)
|
||||
DefaultStockLocation.find_or_create
|
||||
DefaultShippingCategory.find_or_create
|
||||
end
|
||||
|
||||
it "creates some sample data to play with" do
|
||||
Rake.application.invoke_task "ofn:sample_data"
|
||||
|
||||
expect(EnterpriseGroup.count).to eq 1
|
||||
expect(Customer.count).to eq 2
|
||||
expect(Spree::Order.count).to eq 5
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user