Allow to specify an order schedule for new orders.

This commit is contained in:
wvengen 2014-11-22 00:33:16 +01:00
parent 6e990fed4c
commit 219eb71bc9
16 changed files with 204 additions and 8 deletions

View file

@ -44,4 +44,21 @@ describe Order do
end
describe 'with a default end date' do
let(:order) { create :order }
before do
FoodsoftConfig[:order_schedule] = {ends: {recurr: 'FREQ=WEEKLY;BYDAY=MO', time: '9:00'}}
order.init_dates
end
it 'to have a correct date' do
expect(order.ends.to_date).to eq Date.today.next_week.at_beginning_of_week(:monday)
end
it 'to have a correct time' do
expect(order.ends.strftime('%H:%M')).to eq '09:00'
end
end
end