From c1cdf3e331fcc5043fd1453c23d2d7ab7f325f8a Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 27 Feb 2014 16:11:17 +1100 Subject: [PATCH] Removing some dud debugging stuff, fiddling with the checkout spec --- .../darkswarm/controllers/checkout_controller.js.coffee | 1 - app/views/shop/checkout/_form.html.haml | 1 - spec/features/consumer/shopping/checkout_spec.rb | 7 +++++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee index 40f8d221f8..6c4ec5d2cb 100644 --- a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee @@ -4,7 +4,6 @@ angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope) -> $scope.payment_method = -1 $scope.shippingMethodChanged = -> - console.log $("#order_shipping_method_id_" + $scope.shipping_method).attr("data-require-ship-address") $scope.require_ship_address = $("#order_shipping_method_id_" + $scope.shipping_method).attr("data-require-ship-address") $scope.purchase = (event)-> diff --git a/app/views/shop/checkout/_form.html.haml b/app/views/shop/checkout/_form.html.haml index 2688a4dfb7..e84a068424 100644 --- a/app/views/shop/checkout/_form.html.haml +++ b/app/views/shop/checkout/_form.html.haml @@ -36,7 +36,6 @@ .large-6.columns.right = ba.text_field :zipcode - {{ require_ship_address }} %fieldset#shipping %legend Shipping diff --git a/spec/features/consumer/shopping/checkout_spec.rb b/spec/features/consumer/shopping/checkout_spec.rb index 2859a91697..6f4dc1c740 100644 --- a/spec/features/consumer/shopping/checkout_spec.rb +++ b/spec/features/consumer/shopping/checkout_spec.rb @@ -122,7 +122,7 @@ feature "As a consumer I want to check out my cart", js: true do describe "with shipping methods" do let(:sm1) { create(:shipping_method, require_ship_address: true, name: "Frogs", description: "yellow") } - let(:sm2) { create(:shipping_method, require_ship_address: true, name: "Donkeys", description: "blue") } + let(:sm2) { create(:shipping_method, require_ship_address: false, name: "Donkeys", description: "blue") } before do distributor.shipping_methods << sm1 distributor.shipping_methods << sm2 @@ -133,12 +133,14 @@ feature "As a consumer I want to check out my cart", js: true do page.should have_content "Donkeys" end - it "doesn't show ship address forms by default" do + it "doesn't show ship address forms " do + choose(sm2.name) find("#ship_address").visible?.should be_false end it "shows ship address forms when selected shipping method requires one" do choose(sm1.name) + save_and_open_page find("#ship_address").visible?.should be_true end @@ -159,6 +161,7 @@ feature "As a consumer I want to check out my cart", js: true do describe "Purchasing" do it "re-renders with errors when we submit the incomplete form" do + save_and_open_page click_button "Purchase" current_path.should == "/shop/checkout" page.should have_content "can't be blank"