Fix specs

This commit is contained in:
Rohan Mitchell
2016-04-11 08:42:03 +10:00
parent 35117f7af4
commit dac90c8003
3 changed files with 8 additions and 9 deletions

View File

@@ -34,13 +34,13 @@ describe CheckoutController do
flash[:info].should == "The hub you have selected is temporarily closed for orders. Please try again later."
end
it "redirects to the shop when no line items are present" do
it "redirects to the cart when some items are out of stock" do
controller.stub(:current_distributor).and_return(distributor)
controller.stub(:current_order_cycle).and_return(order_cycle)
controller.stub(:current_order).and_return(order)
order.stub_chain(:insufficient_stock_lines, :present?).and_return true
get :edit
response.should redirect_to shop_path
response.should redirect_to spree.cart_path
end
it "renders when both distributor and order cycle is selected" do

View File

@@ -9,7 +9,7 @@ feature "As a consumer I want to check out my cart", js: true do
let(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) }
let(:supplier) { create(:supplier_enterprise) }
let!(:order_cycle) { create(:simple_order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) }
let!(:order_cycle) { create(:simple_order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.variants.first]) }
let(:product) { create(:simple_product, supplier: supplier) }
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
let(:address) { create(:address, firstname: "Foo", lastname: "Bar") }
@@ -23,7 +23,7 @@ feature "As a consumer I want to check out my cart", js: true do
it "does not not render the login form when logged in" do
quick_login_as user
visit checkout_path
visit checkout_path
within "section[role='main']" do
page.should_not have_content "Login"
page.should have_checkout_details
@@ -31,7 +31,7 @@ feature "As a consumer I want to check out my cart", js: true do
end
it "renders the login buttons when logged out" do
visit checkout_path
visit checkout_path
within "section[role='main']" do
page.should have_content "Login"
click_button "Login"
@@ -53,9 +53,8 @@ feature "As a consumer I want to check out my cart", js: true do
end
it "allows user to checkout as guest" do
visit checkout_path
visit checkout_path
checkout_as_guest
page.should have_checkout_details
page.should have_checkout_details
end
end

View File

@@ -318,7 +318,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
let(:variant) { create(:variant, product: product) }
before do
add_product_and_variant_to_order_cycle(exchange, product, variant)
add_variant_to_order_cycle(exchange, variant)
set_order_cycle(order, oc1)
distributor.require_login = true
distributor.save!