-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_test.rb
More file actions
22 lines (19 loc) · 804 Bytes
/
Copy pathsample_test.rb
File metadata and controls
22 lines (19 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require './sample'
describe OrdersReport do
describe '#total_sales_within_date_range' do
it 'returns total sales in range' do
order_within_range1 = Order.new(amount: 5,
placed_at: Date.new(2016, 10, 10))
order_within_range2 = Order.new(amount: 10,
placed_at: Date.new(2016, 10, 15))
order_out_of_range = Order.new(amount: 6,
placed_at: Date.new(2016, 1, 1))
orders = [order_within_range1, order_within_range2, order_out_of_range]
start_date = Date.new(2016, 10, 1)
end_date = Date.new(2016, 10, 31)
expect(OrdersReport.
new(orders, start_date, end_date).
total_sales_within_date_range).to eq(15)
end
end
end