Patching up some edge cases

This commit is contained in:
Will Marshall
2013-12-19 14:20:16 +11:00
parent b5dd921a81
commit 1048bab303
3 changed files with 12 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
Shop.factory 'OrderCycle', ($resource, Product, orderCycleData) ->
class OrderCycle
@order_cycle = orderCycleData || {}
@order_cycle = orderCycleData || {orders_close_at: ""}
@push_order_cycle: ->
new $resource("/shop/order_cycle").save {order_cycle_id: @order_cycle.order_cycle_id}, (order_data)->
OrderCycle.order_cycle.orders_close_at = order_data.orders_close_at

View File

@@ -1,4 +1,9 @@
%ordercycle{"ng-controller" => "OrderCycleCtrl"}
:javascript
angular.module('Shop').value('orderCycleData', #{OrderCycleSerializer.new(current_order_cycle).to_json})
- if @order_cycles.empty?
Orders are currently closed for this hub
%p
@@ -15,8 +20,6 @@
"ng-change" => "changeOrderCycle()",
"ng-options" => "oc.id as oc.time for oc in #{@order_cycles.map {|oc| {time: pickup_time(oc), id: oc.id}}.to_json}"}
:javascript
angular.module('Shop').value('orderCycleData', #{OrderCycleSerializer.new(current_order_cycle).to_json})
%closing
-#%img{src: "/icon/goes/here"}

View File

@@ -55,6 +55,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
it "allows us to select an order cycle" do
select "frogs", :from => "order_cycle_id"
page.should have_selector "products"
page.should have_content "Orders close #{oc1.orders_close_at.strftime('%A %m')}"
Spree::Order.last.order_cycle.should == oc1
end
@@ -74,6 +75,11 @@ feature "As a consumer I want to shop with a distributor", js: true do
end
end
describe "adding products to cart" do
it "should let us add products to our cart"
it "should redirect to the checkout page"
end
context "when no order cycles are available" do
it "tells us orders are closed" do
visit shop_path