|
73 | 73 | end
|
74 | 74 | end
|
75 | 75 |
|
76 |
| - # describe '#count_month_sale_product' do |
77 |
| - # it 'returns the sum of quantities for sale products in the given month' do |
78 |
| - # year = Time.zone.now.year |
79 |
| - # month = Time.zone.now.month |
80 |
| - # create(:sale_product, product: product, quantity: 5, created_at: Time.zone.local(year, month, 15)) |
81 |
| - # create(:sale_product, product: product, quantity: 3, created_at: Time.zone.local(year, month, 20)) |
82 |
| - # expect(product.count_month_sale_product(year, month)).to eq(8) |
83 |
| - # end |
84 |
| - # end |
| 76 | + describe '#count_month_sale_product' do |
| 77 | + let(:account) { create(:account) } |
| 78 | + |
| 79 | + it 'returns the sum of quantities for sale products in the given month' do |
| 80 | + year = Time.zone.now.year |
| 81 | + month = Time.zone.now.month |
| 82 | + create(:sale_product, product:, account:, quantity: 5, created_at: Time.zone.local(year, month, 15)) |
| 83 | + create(:sale_product, product:, account:, quantity: 3, created_at: Time.zone.local(year, month, 20)) |
| 84 | + |
| 85 | + expect(product.count_month_sale_product(year, month)).to eq(8) |
| 86 | + end |
| 87 | + end |
85 | 88 |
|
86 | 89 | # describe '#sum_simplo_items' do
|
87 | 90 | # it 'returns the sum of quantities for simplo items' do
|
|
0 commit comments