start adding integration tests
This commit is contained in:
parent
7dfa8bf45a
commit
4b8dbdbfeb
|
@ -90,6 +90,7 @@ module Spree
|
|||
@order.ship_address = order_ship_address
|
||||
@order.bill_address ||= order_ship_address
|
||||
end
|
||||
|
||||
@order.save
|
||||
|
||||
if payment_method.preferred_review
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
<h1><%= t("confirm") %></h1>
|
||||
<p>
|
||||
<%= raw t("order_not_yet_placed") %>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<div id="checkout" data-hook>
|
||||
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @order } %>
|
||||
|
||||
|
@ -13,6 +6,10 @@
|
|||
<div class="columns thirteen omega" data-hook="checkout_progress"><%= checkout_progress %></div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<%= raw t("order_not_yet_placed") %>
|
||||
</p>
|
||||
|
||||
<div class="row" data-hook="checkout_content">
|
||||
<div class="columns <%= if @order.state != 'confirm' then 'alpha twelve' else 'alpha omega sixteen' end %>" data-hook="checkout_form_wrapper">
|
||||
<%= render :partial => 'spree/shared/order_details', :locals => {:order => @order} -%>
|
||||
|
|
|
@ -108,7 +108,7 @@ module Spree
|
|||
get :paypal_confirm, {:order_id => order.number, :payment_method_id => "123", :token => token, :PayerID => "FWRVKNRRZ3WUC" }
|
||||
|
||||
response.should render_template("shared/paypal_express_confirm")
|
||||
|
||||
order.state.should == "payment"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
FactoryGirl.define do
|
||||
factory :ppx, :class => Spree::BillingIntegration::PaypalExpress, :parent => :payment_method do
|
||||
name 'Paypal'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature "paypal express" do
|
||||
background do
|
||||
PAYMENT_STATES = Spree::Payment.state_machine.states.keys unless defined? PAYMENT_STATES
|
||||
SHIPMENT_STATES = Spree::Shipment.state_machine.states.keys unless defined? SHIPMENT_STATES
|
||||
ORDER_STATES = Spree::Order.state_machine.states.keys unless defined? ORDER_STATES
|
||||
FactoryGirl.create(:shipping_method, :zone => Spree::Zone.find_by_name('North America'))
|
||||
FactoryGirl.create(:payment_method, :environment => 'test')
|
||||
@product = FactoryGirl.create(:product, :name => "RoR Mug")
|
||||
sign_in_as! FactoryGirl.create(:user)
|
||||
|
||||
Factory(:ppx)
|
||||
end
|
||||
|
||||
let!(:address) { FactoryGirl.create(:address, :state => Spree::State.first) }
|
||||
|
||||
scenario "can use paypal confirm", :js => true do
|
||||
visit spree.product_path(@product)
|
||||
|
||||
click_button "Add To Cart"
|
||||
click_link "Checkout"
|
||||
|
||||
str_addr = "bill_address"
|
||||
select "United States", :from => "order_#{str_addr}_attributes_country_id"
|
||||
['firstname', 'lastname', 'address1', 'city', 'zipcode', 'phone'].each do |field|
|
||||
fill_in "order_#{str_addr}_attributes_#{field}", :with => "#{address.send(field)}"
|
||||
end
|
||||
save_and_open_page
|
||||
|
||||
|
||||
select "#{address.state.name}", :from => "order_#{str_addr}_attributes_state_id"
|
||||
check "order_use_billing"
|
||||
click_button "Save and Continue"
|
||||
|
||||
choose "Paypal"
|
||||
pending
|
||||
click_button "Save and Continue"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
module AuthenticationHelpers
|
||||
def sign_in_as!(user)
|
||||
visit '/login'
|
||||
fill_in 'Email', :with => user.email
|
||||
fill_in 'Password', :with => 'secret'
|
||||
click_button 'Login'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include AuthenticationHelpers, :type => :request
|
||||
end
|
Loading…
Reference in New Issue