Files
openfoodnetwork/spec/lib/tasks/sample_data_rake_spec.rb
Maikel Linke f532c4712e Load rake tasks only once for code coverage
Apparently, Rake's way of reloading the task code confuses the code
coverage report. Code tested by rake task specs was not recognised as
covered even though it was.
2025-08-05 12:44:13 +10:00

22 lines
458 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'sample_data.rake' do
include_context "rake"
before do
# Create seed data required by the sample data.
create(:user)
DefaultShippingCategory.find_or_create
end
it "creates some sample data to play with" do
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