Major supplier refactor making the whole system work better

This commit is contained in:
2014-08-07 15:50:06 +02:00
parent e61767fe78
commit b4353113e1
40 changed files with 6614 additions and 4354 deletions
+8
View File
@@ -156,4 +156,12 @@ describe List do
describe 'product order creation'
end
describe '#close!' do
it 'removes the helped mark' do
list_options[:needs_help] = true
list.close!
expect( list.needs_help? ).not_to be true
end
end
end
+22
View File
@@ -153,4 +153,26 @@ describe Order do
end
end
end
describe '#close!' do
describe 'counters' do
before do
# hack some initial values
Qwaiter::Counter.set "supplier_counter:#{supplier.id}:orders_placed", 11
Qwaiter::Counter.set "supplier_counter:#{supplier.id}:orders_in_process", 7
end
it "decrements the orders_placed_count for when a placed order is closed" do
order.close!
supplier.orders_placed_count.should == 10
supplier.orders_in_process_count.should == 7
end
it "decrements the orders_in_process_count for when an active order is closed" do
order_options[:state] = 'active'
order.close!
supplier.orders_placed_count.should == 11
supplier.orders_in_process_count.should == 6
end
end
end
end