From b1d01820a6b99493fc16ef7a61a60cd016920cc6 Mon Sep 17 00:00:00 2001 From: Brian Quinn Date: Fri, 20 Jul 2012 12:06:56 +0100 Subject: [PATCH] Setup travis --- Gemfile | 11 ---------- spec/controllers/checkout_controller_spec.rb | 2 +- spec/factories/order_factory.rb | 2 +- spec/requests/paypal_express_spec.rb | 11 ++++------ spec/spec_helper.rb | 21 +------------------- spree_paypal_express.gemspec | 6 ++++++ 6 files changed, 13 insertions(+), 40 deletions(-) diff --git a/Gemfile b/Gemfile index 1279721..d65e2a6 100644 --- a/Gemfile +++ b/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 diff --git a/spec/controllers/checkout_controller_spec.rb b/spec/controllers/checkout_controller_spec.rb index 8a30e5f..acc5a32 100644 --- a/spec/controllers/checkout_controller_spec.rb +++ b/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) } diff --git a/spec/factories/order_factory.rb b/spec/factories/order_factory.rb index cd8d9fc..e2a5f49 100644 --- a/spec/factories/order_factory.rb +++ b/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 diff --git a/spec/requests/paypal_express_spec.rb b/spec/requests/paypal_express_spec.rb index 63cdb58..3d78ef3 100644 --- a/spec/requests/paypal_express_spec.rb +++ b/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" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 70631c3..8253134 100644 --- a/spec/spec_helper.rb +++ b/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 diff --git a/spree_paypal_express.gemspec b/spree_paypal_express.gemspec index 286e349..0766415 100644 --- a/spree_paypal_express.gemspec +++ b/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