diff --git a/Appraisals b/Appraisals index 35da0648..337b50b6 100644 --- a/Appraisals +++ b/Appraisals @@ -3,12 +3,12 @@ appraise "rails-4" do gem 'bigdecimal', '~> 1.4' end -appraise "rails-5" do - gem 'activemodel', '~> 5.0.7' - gem 'bigdecimal' -end +# appraise "rails-5" do +# gem 'activemodel', '~> 5.0.7' +# gem 'bigdecimal' +# end -appraise "rails-6" do - gem 'activemodel', '~> 6.0.1' - gem 'bigdecimal' -end +# appraise "rails-6" do +# gem 'activemodel', '~> 6.0.1' +# gem 'bigdecimal' +# end diff --git a/Dockerfile b/Dockerfile index 50fac1b7..25c9d852 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -ARG RUBY_VERSION=${RUBY_VERSION:-3.2.0} +ARG RUBY_VERSION=${RUBY_VERSION:-2.7} FROM ruby:${RUBY_VERSION}-alpine RUN apk --update add --no-cache build-base bash && \ apk add git && \ - apk add --no-cache libffi-dev && \ apk add --no-cache libxml2 && \ apk add --no-cache libxml2-dev && \ - apk add --no-cache sqlite-dev + apk add --no-cache sqlite-dev && \ + apk add --no-cache musl-dev && \ + apk add --no-cache libc6-compat + +RUN gem install nokogiri -v '1.15.6' -- --use-system-libraries RUN gem update --system 3.3.22 --no-document && \ gem install bundler --no-document diff --git a/spec/factories/accounts.rb b/spec/factories/accounts.rb index 27b01df3..dc5149d8 100644 --- a/spec/factories/accounts.rb +++ b/spec/factories/accounts.rb @@ -1,4 +1,4 @@ -FactoryGirl.define do +FactoryBot.define do factory :account, :class => Zuora::Objects::Account do sequence(:name){|n| "Test Account #{n}"} sequence(:account_number){|n| "test_account_#{n}" } @@ -6,7 +6,7 @@ factory :active_account, :parent => :account do after_create do |account| - contact = FactoryGirl.create(:contact, :account => account, :country => "GB") + contact = FactoryBot.create(:contact, :account => account, :country => "GB") account.bill_to = contact account.sold_to = contact account.status = "Active" diff --git a/spec/factories/contacts.rb b/spec/factories/contacts.rb index daab9721..e6cc5524 100644 --- a/spec/factories/contacts.rb +++ b/spec/factories/contacts.rb @@ -1,6 +1,6 @@ -FactoryGirl.define do +FactoryBot.define do factory :contact, :class => Zuora::Objects::Contact do - first_name "Example" + first_name { "Example" } sequence(:last_name){|n| "User #{n}" } end end diff --git a/spec/factories/payment_methods.rb b/spec/factories/payment_methods.rb index 50723ff2..9d3e1309 100644 --- a/spec/factories/payment_methods.rb +++ b/spec/factories/payment_methods.rb @@ -1,34 +1,36 @@ -FactoryGirl.define do +FactoryBot.define do factory :payment_method_credit_card, :class => Zuora::Objects::PaymentMethod do - type "CreditCard" - credit_card_address1 "123 Testing Lane" - credit_card_city "San Francisco" - credit_card_state "California" - credit_card_postal_code "95611" - credit_card_holder_name "Example User" - credit_card_number "4111111111111111" - credit_card_type "Visa" - credit_card_expiration_month "9" - credit_card_expiration_year "2018" + type { "CreditCard" } + credit_card_address1 { "123 Testing Lane" } + credit_card_city { "San Francisco" } + credit_card_state { "California" } + credit_card_postal_code { "95611" } + credit_card_holder_name { "Example User" } + credit_card_number { "4111111111111111" } + credit_card_type { "Visa" } + credit_card_expiration_month { "9" } + credit_card_expiration_year { "2018" } end factory :payment_method_debit_card, :parent => :payment_method_credit_card do - type "DebitCard" + type { "DebitCard" } end - factory :payment_method_ach, :class => Zuora::Objects::PaymentMethod do - type "ACH" - ach_aba_code '123456789' - ach_account_name 'My Checking Account' - ach_account_number '987654321' - ach_bank_name 'Bank of Zuora' - ach_account_type 'BusinessChecking' - end + FactoryBot.define do + factory :payment_method_ach, class: Zuora::Objects::PaymentMethod do + type { "ACH" } + ach_aba_code { '123456789' } + ach_account_name { 'My Checking Account' } + ach_account_number { '987654321' } + ach_bank_name { 'Bank of Zuora' } + ach_account_type { 'BusinessChecking' } + end - factory :payment_method_paypal, :class => Zuora::Objects::PaymentMethod do - type 'PayPal' - paypal_baid "ExampleBillingAgreementId" - paypal_email "example@example.org" - paypal_type "ExpressCheckout" + factory :payment_method_paypal, class: Zuora::Objects::PaymentMethod do + type { 'PayPal' } + paypal_baid { "ExampleBillingAgreementId" } + paypal_email { "example@example.org" } + paypal_type { "ExpressCheckout" } + end end end diff --git a/spec/factories/product_rate_plan_charge_tiers.rb b/spec/factories/product_rate_plan_charge_tiers.rb index d796f749..d7e688a3 100644 --- a/spec/factories/product_rate_plan_charge_tiers.rb +++ b/spec/factories/product_rate_plan_charge_tiers.rb @@ -1,7 +1,7 @@ -FactoryGirl.define do +FactoryBot.define do factory :product_rate_plan_charge_tier, :class => Zuora::Objects::ProductRatePlanChargeTier do - price 0 - starting_unit 0 - ending_unit 10 + price { 0 } + starting_unit { 0 } + ending_unit { 10 } end end diff --git a/spec/factories/product_rate_plan_charges.rb b/spec/factories/product_rate_plan_charges.rb index 64fe8297..49ffa0e7 100644 --- a/spec/factories/product_rate_plan_charges.rb +++ b/spec/factories/product_rate_plan_charges.rb @@ -1,18 +1,18 @@ -FactoryGirl.define do - factory :product_rate_plan_charge, :class => Zuora::Objects::ProductRatePlanCharge do +FactoryBot.define do + factory :product_rate_plan_charge, class: Zuora::Objects::ProductRatePlanCharge do association :product_rate_plan sequence(:name){|n| "Rate Plan Charge #{n}"} - bill_cycle_type "DefaultFromCustomer" - billing_period "Month" - billing_period_alignment "AlignToCharge" - charge_model "Volume Pricing" - charge_type "Recurring" - included_units "1" - smoothing_model "Rollover" - uom "Each" - trigger_event "ServiceActivation" - after_build do |prpc| - prpc.product_rate_plan_charge_tiers << FactoryGirl.build(:product_rate_plan_charge_tier) + bill_cycle_type { "DefaultFromCustomer" } + billing_period { "Month" } + billing_period_alignment { "AlignToCharge" } + charge_model { "Volume Pricing" } + charge_type { "Recurring" } + included_units { "1" } + smoothing_model { "Rollover" } + uom { "Each" } + trigger_event { "ServiceActivation" } + after(:build) do |prpc| + prpc.product_rate_plan_charge_tiers << FactoryBot.build(:product_rate_plan_charge_tier) end end end diff --git a/spec/factories/product_rate_plans.rb b/spec/factories/product_rate_plans.rb index c2d902b4..4cc53a22 100644 --- a/spec/factories/product_rate_plans.rb +++ b/spec/factories/product_rate_plans.rb @@ -1,8 +1,8 @@ -FactoryGirl.define do - factory :product_rate_plan, :class => Zuora::Objects::ProductRatePlan do +FactoryBot.define do + factory :product_rate_plan, class: Zuora::Objects::ProductRatePlan do sequence(:name){|n| "Rate Plan #{n}"} association :product - effective_start_date DateTime.now - effective_end_date DateTime.now + 10.days + effective_start_date { DateTime.now } + effective_end_date { DateTime.now + 10.days } end end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index 7a53dd2c..9422a2e9 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -1,14 +1,14 @@ -FactoryGirl.define do - factory :product, :class => Zuora::Objects::Product do - sequence(:name){|n| "Example Product #{n}"} - effective_start_date DateTime.now - effective_end_date DateTime.now + 10.days +FactoryBot.define do + factory :product, class: Zuora::Objects::Product do + sequence(:name) { |n| "Example Product #{n}" } + effective_start_date { DateTime.now } + effective_end_date { DateTime.now + 10.days } end - factory :product_catalog, :parent => :product do - after_create do |product| - rate_plan = FactoryGirl.create(:product_rate_plan, :product => product) - FactoryGirl.create(:product_rate_plan_charge, :product_rate_plan => rate_plan) + factory :product_catalog, parent: :product do + after(:create) do |product| + rate_plan = FactoryBot.create(:product_rate_plan, product: product) + FactoryBot.create(:product_rate_plan_charge, product_rate_plan: rate_plan) end end end diff --git a/spec/factories/subscriptions.rb b/spec/factories/subscriptions.rb index 544dbac0..13601b0c 100644 --- a/spec/factories/subscriptions.rb +++ b/spec/factories/subscriptions.rb @@ -1,7 +1,7 @@ -FactoryGirl.define do - factory :subscription, :class => Zuora::Objects::Subscription do - contract_effective_date DateTime.now - sequence(:name){|n| "Example Subscription #{n}"} - term_start_date DateTime.now +FactoryBot.define do + factory :subscription, class: Zuora::Objects::Subscription do + contract_effective_date { DateTime.now } + sequence(:name) { |n| "Example Subscription #{n}" } + term_start_date { DateTime.now } end end diff --git a/spec/integration/account_management_spec.rb b/spec/integration/account_management_spec.rb index aeb7af02..7df427ae 100644 --- a/spec/integration/account_management_spec.rb +++ b/spec/integration/account_management_spec.rb @@ -6,7 +6,7 @@ before :each do authenticate! - @account = FactoryGirl.create(:account, :account_number => generate_key) + @account = FactoryBot.create(:account, :account_number => generate_key) end after :each do @@ -15,7 +15,7 @@ describe "adding and manipulating contacts" do it "is supported" do - contact = FactoryGirl.create(:contact, :account => @account, :country => "GB") + contact = FactoryBot.create(:contact, :account => @account, :country => "GB") @account.bill_to = contact @account.sold_to = contact @account.save.should == true @@ -27,23 +27,23 @@ describe "supported payment methods" do it "includes credit cards" do - FactoryGirl.create(:payment_method_credit_card, :account => @account) + FactoryBot.create(:payment_method_credit_card, :account => @account) end it "includes ACH" do - FactoryGirl.create(:payment_method_ach, :account => @account) + FactoryBot.create(:payment_method_ach, :account => @account) end it "includes PayPal" do # TODO: This cannot work unless Zuora is set up with proper paypal configs. - # FactoryGirl.create(:payment_method_paypal, :account => @account) + # FactoryBot.create(:payment_method_paypal, :account => @account) end end end describe "an active account fixture" do it "can be destroyed" do - account = FactoryGirl.create(:active_account, :account_number => generate_key) + account = FactoryBot.create(:active_account, :account_number => generate_key) account.status.should == 'Active' account.destroy.should == true end diff --git a/spec/integration/product_catalog_spec.rb b/spec/integration/product_catalog_spec.rb index b654ed96..e56232c7 100644 --- a/spec/integration/product_catalog_spec.rb +++ b/spec/integration/product_catalog_spec.rb @@ -9,8 +9,8 @@ after do Zuora::Objects::Product.where(:name => @product_name).map(&:destroy) end - + it "creates a product catalog" do - product_catalog = FactoryGirl.create(:product_catalog, :name => @product_name) + product_catalog = FactoryBot.create(:product_catalog, :name => @product_name) end end diff --git a/spec/integration/subscription_spec.rb b/spec/integration/subscription_spec.rb index b95d6aa8..8528715f 100644 --- a/spec/integration/subscription_spec.rb +++ b/spec/integration/subscription_spec.rb @@ -3,8 +3,8 @@ describe 'Subscription', type: :integration do before :each do authenticate! - @account = FactoryGirl.create(:active_account, account_number: generate_key) - @product = FactoryGirl.create(:product_catalog, name: generate_key) + @account = FactoryBot.create(:active_account, account_number: generate_key) + @product = FactoryBot.create(:product_catalog, name: generate_key) end after :each do @@ -13,10 +13,10 @@ end it 'can be created' do - payment_method = FactoryGirl.create(:payment_method_credit_card, account: @account) + payment_method = FactoryBot.create(:payment_method_credit_card, account: @account) bill_to_contact = @account.contacts.first product_rate_plan = @product.product_rate_plans.first - subscription = FactoryGirl.build(:subscription, account: @account) + subscription = FactoryBot.build(:subscription, account: @account) request = Zuora::Objects::SubscribeRequest.new( account: @account, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 86098384..cfdd8623 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ require 'zuora' require 'artifice' require 'digest/md5' -require 'factory_girl' +require 'factory_bot' Dir["#{File.dirname(__FILE__)}/../spec/support/**/*.rb"].sort.each { |ext| require ext } Dir["#{File.dirname(__FILE__)}/../spec/factories/*.rb"].sort.each { |ext| require ext } diff --git a/spec/zuora/objects/payment_method_spec.rb b/spec/zuora/objects/payment_method_spec.rb index dbfa9995..c01e496e 100644 --- a/spec/zuora/objects/payment_method_spec.rb +++ b/spec/zuora/objects/payment_method_spec.rb @@ -9,29 +9,29 @@ context 'Type helpers' do it 'supports credit_card?' do - FactoryGirl.build(:payment_method_credit_card).should be_credit_card + FactoryBot.build(:payment_method_credit_card).should be_credit_card end it 'supports ach?' do - FactoryGirl.build(:payment_method_ach).should be_ach + FactoryBot.build(:payment_method_ach).should be_ach end it 'supports paypal?' do - FactoryGirl.build(:payment_method_paypal).should be_paypal + FactoryBot.build(:payment_method_paypal).should be_paypal end it 'supports debit_card?' do - FactoryGirl.build(:payment_method_debit_card).should be_debit_card + FactoryBot.build(:payment_method_debit_card).should be_debit_card end it 'supports card?' do - FactoryGirl.build(:payment_method_credit_card).should be_card - FactoryGirl.build(:payment_method_debit_card).should be_card + FactoryBot.build(:payment_method_credit_card).should be_card + FactoryBot.build(:payment_method_debit_card).should be_card end end context 'write only attributes' do - ach = FactoryGirl.build(:payment_method_ach) + ach = FactoryBot.build(:payment_method_ach) ach.write_only_attributes.should == [:ach_account_number, :credit_card_number, :credit_card_security_code, :gateway_option_data, :skip_validation, :bank_transfer_account_number] end @@ -62,7 +62,7 @@ describe "Credit Card" do it "generates proper request xml" do MockResponse.responds_with(:payment_method_credit_card_create_success) do - FactoryGirl.create(:payment_method_credit_card, :account => @account, credit_card_expiration_year: '2025') + FactoryBot.create(:payment_method_credit_card, :account => @account, credit_card_expiration_year: '2025') xml = Zuora::Api.instance.last_request xml.should have_xml("//env:Body/#{zns}:create/#{zns}:zObjects/#{ons}:Type"). @@ -99,7 +99,7 @@ context 'ACH' do it 'generates proper request xml' do MockResponse.responds_with(:payment_method_ach_create_success) do - FactoryGirl.create(:payment_method_ach, account: @account) + FactoryBot.create(:payment_method_ach, account: @account) xml = Zuora::Api.instance.last_request xml.should have_xml("//env:Body/#{zns}:create/#{zns}:zObjects/#{ons}:Type") @@ -128,7 +128,7 @@ context 'PayPal' do it 'generates proper request xml' do MockResponse.responds_with(:payment_method_ach_create_success) do - FactoryGirl.create(:payment_method_paypal, account: @account) + FactoryBot.create(:payment_method_paypal, account: @account) xml = Zuora::Api.instance.last_request xml.should have_xml("//env:Body/#{zns}:create/#{zns}:zObjects/#{ons}:Type") diff --git a/spec/zuora/objects/subscribe_request_spec.rb b/spec/zuora/objects/subscribe_request_spec.rb index f79778c8..10b8ef48 100644 --- a/spec/zuora/objects/subscribe_request_spec.rb +++ b/spec/zuora/objects/subscribe_request_spec.rb @@ -28,7 +28,7 @@ subject.product_rate_plan = Zuora::Objects::ProductRatePlan.find('stub') end - subject.subscription = FactoryGirl.build(:subscription) + subject.subscription = FactoryBot.build(:subscription) end it "provides properly formatted xml when using existing objects" do @@ -52,7 +52,7 @@ end it "provides full account info when new object" do - subject.account = FactoryGirl.build(:account) + subject.account = FactoryBot.build(:account) MockResponse.responds_with(:subscribe_request_success) do subject.should be_valid @@ -68,7 +68,7 @@ end it "provides full bill_to_contact info when new object" do - subject.bill_to_contact = FactoryGirl.build(:contact, :account => @account) + subject.bill_to_contact = FactoryBot.build(:contact, :account => @account) MockResponse.responds_with(:subscribe_request_success) do subject.should be_valid @@ -83,7 +83,7 @@ end it "provides full payment_method info when new object" do - subject.payment_method = FactoryGirl.build(:payment_method_ach, :account => @account, :ach_account_name => 'Testing') + subject.payment_method = FactoryBot.build(:payment_method_ach, :account => @account, :ach_account_name => 'Testing') MockResponse.responds_with(:subscribe_request_success) do subject.should be_valid diff --git a/zuora.gemspec b/zuora.gemspec index 1bab295c..ebf4268e 100644 --- a/zuora.gemspec +++ b/zuora.gemspec @@ -21,8 +21,8 @@ Gem::Specification.new do |s| s.extra_rdoc_files = ['README.md'] s.add_dependency 'activemodel', '>= 4.2.11' - s.add_dependency 'activesupport', '>= 4.2.11' - s.add_dependency 'httpi', '~> 4.0.2' + # s.add_dependency 'activesupport', '>= 4.2.11' + # s.add_dependency 'httpi', '~> 4.0.2' s.add_dependency 'i18n', '~> 0.7' s.add_dependency 'libxml4r', '~> 0.2.6' s.add_dependency 'savon', '~> 2.15.0' @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'redcarpet', '~> 2.1.0' s.add_development_dependency 'rspec', '~> 3.0' s.add_development_dependency 'simplecov', '~> 0.22.0' - s.add_development_dependency 'sqlite3', '~> 2.0' + s.add_development_dependency 'sqlite3', '~> 1.3' s.add_development_dependency 'test-unit' s.add_development_dependency 'yard', '~> 0.7.5' end