Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Memoizing test setup
require_relative './path/to/sales_engine_test_setup'
class InvoiceRepositoryTest < Minitest::Test
include SalesEngineTestSetup
def setup
super
# Any additional setup needed for InvoiceRepository tests
end
# tests go here...
end
module SalesEngineTestSetup
attr_reader :sales_engine
def setup
@@sales_engine ||= load_sales_engine_data
@sales_engine = @@sales_engine.dup
end
private
def load_sales_engine_data
puts 'Loading sales engine data!!!!'
SalesEngine.from_csv({
:invoices => "./data/invoices.csv",
:items => "./data/items.csv",
:merchants => "./data/merchants.csv",
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.