Browse Source

Setup travis

1-2-stable-sysmocom
Brian Quinn 9 years ago
parent
commit
b1d01820a6
  1. 11
      Gemfile
  2. 2
      spec/controllers/checkout_controller_spec.rb
  3. 2
      spec/factories/order_factory.rb
  4. 11
      spec/requests/paypal_express_spec.rb
  5. 21
      spec/spec_helper.rb
  6. 6
      spree_paypal_express.gemspec

11
Gemfile

@ -1,14 +1,3 @@
source 'http://rubygems.org'
gemspec
gem 'sqlite3'
gem 'spree', '1.1.2'
group :test do
gem 'rspec-rails', '= 2.7.0'
gem 'factory_girl_rails', '= 1.3.0'
gem 'simplecov'
gem 'shoulda'
gem 'faker'
end

2
spec/controllers/checkout_controller_spec.rb

@ -4,7 +4,7 @@ module Spree
describe CheckoutController do
render_views
let(:token) { "EC-2OPN7UJGFWK9OYFV" }
let(:order) { Factory(:ppx_order_with_totals, :state => "payment", :shipping_method => shipping_method) }
let(:order) { FactoryGirl.create(:ppx_order_with_totals, :state => "payment", :shipping_method => shipping_method) }
let(:shipping_method) { FactoryGirl.create(:shipping_method, :zone => Spree::Zone.find_by_name('North America')) }
let(:order_total) { (order.total * 100).to_i }
let(:gateway_provider) { mock(ActiveMerchant::Billing::PaypalExpressGateway) }

2
spec/factories/order_factory.rb

@ -7,5 +7,5 @@ Factory.define(:ppx_order) do |record|
end
Factory.define :ppx_order_with_totals, :parent => :order do |f|
f.after_create { |order| Factory(:line_item, :order => order, :price => 10) and order.line_items.reload }
f.after_create { |order| FactoryGirl.create(:line_item, :order => order, :price => 10) and order.line_items.reload }
end

11
spec/requests/paypal_express_spec.rb

@ -1,21 +1,18 @@
require 'spec_helper'
feature "Paypal Express checkout" 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
describe "Paypal Express checkout" do
before do
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)
FactoryGirl.create(:ppx)
end
let!(:address) { FactoryGirl.create(:address, :state => Spree::State.first) }
scenario "should display paypal link", :js => true do
it "should display paypal link", :js => true do
visit spree.product_path(@product)
click_button "Add To Cart"

21
spec/spec_helper.rb

@ -3,6 +3,7 @@
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
@ -21,20 +22,10 @@ end
require 'ffaker'
RSpec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
config.include Spree::UrlHelpers
end
@ -44,13 +35,3 @@ Spree::Zone.class_eval do
find_by_name("GlobalZone") || Factory(:global_zone)
end
end
# class ActionController::TestCase
# module Behavior
# def process_with_default_host(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# parameters = { :host => 'example.com' }.merge( parameters || {} )
# process_without_default_host(action, parameters, session, flash, http_method)
# end
# alias_method_chain :process, :default_host
# end
# end

6
spree_paypal_express.gemspec

@ -15,4 +15,10 @@ Gem::Specification.new do |s|
s.add_dependency('spree_core', '>=1.0.0')
s.add_dependency('spree_auth', '>=1.0.0')
s.add_development_dependency 'capybara', '1.1.2'
s.add_development_dependency 'factory_girl', '~> 3.5.0'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 2.11.0'
s.add_development_dependency 'sqlite3'
end

Loading…
Cancel
Save