From 81f64239502a7b71576b80b1e71377c898800a07 Mon Sep 17 00:00:00 2001 From: Tapan Sharma Date: Wed, 19 Jun 2024 15:05:42 +0100 Subject: [PATCH] Add appraisals gem - Support Rails 4 - 7 --- .github/workflows/ci.yml | 31 ++++++++--- Appraisals | 29 +++++++---- Dockerfile | 9 ++-- Gemfile | 4 -- docker-compose.yml | 2 - gemfiles/rails_4.gemfile | 10 ++++ gemfiles/rails_5.gemfile | 10 ++++ gemfiles/rails_6.gemfile | 9 ++++ gemfiles/rails_7.gemfile | 9 ++++ lib/zuora/attributes.rb | 27 +++++----- lib/zuora/objects/amendment.rb | 2 +- lib/zuora/objects/base.rb | 8 +-- lib/zuora/objects/subscribe_request.rb | 2 +- lib/zuora/validations.rb | 4 +- spec/factories/accounts.rb | 4 +- spec/factories/contacts.rb | 4 +- spec/factories/payment_methods.rb | 52 ++++++++++--------- .../product_rate_plan_charge_tiers.rb | 8 +-- spec/factories/product_rate_plan_charges.rb | 26 +++++----- spec/factories/product_rate_plans.rb | 8 +-- spec/factories/products.rb | 18 +++---- spec/factories/subscriptions.rb | 10 ++-- spec/integration/account_management_spec.rb | 12 ++--- spec/integration/product_catalog_spec.rb | 4 +- spec/integration/subscription_spec.rb | 8 +-- spec/spec_helper.rb | 2 +- spec/zuora/objects/payment_method_spec.rb | 20 +++---- spec/zuora/objects/subscribe_request_spec.rb | 8 +-- zuora.gemspec | 33 ++++++------ 29 files changed, 220 insertions(+), 153 deletions(-) create mode 100644 gemfiles/rails_4.gemfile create mode 100644 gemfiles/rails_5.gemfile create mode 100644 gemfiles/rails_6.gemfile create mode 100644 gemfiles/rails_7.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 769399bd..674a696f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,17 +5,36 @@ on: [push] jobs: test: runs-on: ubuntu-latest - + env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile strategy: matrix: - ruby-version: ['2.7', '3.0', '3.1', '3.2'] + gemfile: + - rails_4 + - rails_5 + - rails_6 + - rails_7 + rubygems: + - default + ruby: + - '2.7' + - '3.2' + exclude: + - gemfile: rails_4 + ruby: '3.2' + - gemfile: rails_6 + ruby: '2.7' + - gemfile: rails_7 + ruby: '2.7' + name: ${{ matrix.gemfile }}, Ruby ${{ matrix.ruby }} steps: - uses: actions/checkout@v4 - - name: Set up Ruby ${{ matrix.ruby-version }} + - name: Set up Ruby and Bundle uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby-version }} + ruby-version: ${{ matrix.ruby }} + rubygems: ${{ matrix.rubygems }} bundler-cache: true - name: Export ENV @@ -37,7 +56,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.2.0' + ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Clear any existing packages run: rm -f $GEMS_PATH @@ -49,4 +68,4 @@ jobs: - name: Build gem run: bundle exec rake build zuora.gemspec - name: Publish - run: gem push $GEMS_PATH + run: gem push $GEMS_PATH \ No newline at end of file diff --git a/Appraisals b/Appraisals index 124a1b98..596ad7af 100644 --- a/Appraisals +++ b/Appraisals @@ -1,14 +1,25 @@ -appraise "rails30" do - gem 'activesupport', '~> 3.0.0' - gem 'activemodel', '~> 3.0.0' +appraise "rails-4" do + gem 'activemodel', '~> 4.2' + gem 'bigdecimal', '~> 1.4' + gem 'sqlite3', '~> 1.3' + gem 'rack', '~> 2.0' end -appraise "rails31" do - gem 'activesupport', '~> 3.1.0' - gem 'activemodel', '~> 3.1.0' +appraise "rails-5" do + gem 'activemodel', '~> 5.2' + gem 'sqlite3', '~> 1.4.0' + gem 'i18n', '~> 1.5.1' + gem 'rack', '~> 2.0' end -appraise "rails32" do - gem 'activesupport', '~> 3.2.0' - gem 'activemodel', '~> 3.2.0' +appraise "rails-6" do + gem 'activemodel', '~> 6.0' + gem 'sqlite3' + gem 'httpi', '~> 4.0' +end + +appraise "rails-7" do + gem 'activemodel', '~> 7.0' + gem 'sqlite3' + gem 'httpi', '~> 4.0' end diff --git a/Dockerfile b/Dockerfile index 50fac1b7..da80677d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -ARG RUBY_VERSION=${RUBY_VERSION:-3.2.0} +ARG RUBY_VERSION=${RUBY_VERSION:-3.2} 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/Gemfile b/Gemfile index 2801ba81..7f4f5e95 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,3 @@ source 'https://rubygems.org' gemspec - -gem 'akami', '~> 1.3.2' -gem 'nokogiri', '~> 1.15.6' -gem 'wasabi', '>= 3.7' diff --git a/docker-compose.yml b/docker-compose.yml index 81dc1cef..9356f048 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '2' - services: client: build: diff --git a/gemfiles/rails_4.gemfile b/gemfiles/rails_4.gemfile new file mode 100644 index 00000000..73a8810f --- /dev/null +++ b/gemfiles/rails_4.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 4.2" +gem "bigdecimal", "~> 1.4" +gem "sqlite3", "~> 1.3" +gem "rack", "~> 2.0" + +gemspec path: "../" diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile new file mode 100644 index 00000000..e93471ef --- /dev/null +++ b/gemfiles/rails_5.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 5.2" +gem "sqlite3", "~> 1.4.0" +gem "i18n", "~> 1.5.1" +gem "rack", "~> 2.0" + +gemspec path: "../" diff --git a/gemfiles/rails_6.gemfile b/gemfiles/rails_6.gemfile new file mode 100644 index 00000000..9d7d49a9 --- /dev/null +++ b/gemfiles/rails_6.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 6.0" +gem "sqlite3" +gem "httpi", "~> 4.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7.gemfile b/gemfiles/rails_7.gemfile new file mode 100644 index 00000000..09ae63d8 --- /dev/null +++ b/gemfiles/rails_7.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 7.0" +gem "sqlite3" +gem "httpi", "~> 4.0" + +gemspec path: "../" diff --git a/lib/zuora/attributes.rb b/lib/zuora/attributes.rb index a41f637e..e12cb379 100644 --- a/lib/zuora/attributes.rb +++ b/lib/zuora/attributes.rb @@ -1,5 +1,6 @@ module Zuora module Attributes + def self.included(base) base.send(:include, ActiveModel::Naming) base.send(:include, ActiveModel::Conversion) @@ -39,19 +40,17 @@ def define_attributes(&block) # generate association overrides for complex object handling # and cache the objects so that they may be modified and updated class_variable_get(:@@complex_attributes).each do |var, scope| - # set up the instance variable for the new assoc collection - # for new records, but call the original one for existing - # records and cache/return the result for subsequent calls. - class_eval <<-EVAL - def #{scope}_with_complex - if new_record? || @#{scope}_cached - @#{scope} ||= [] - else - @#{scope}_cached = true - @#{scope} = #{scope}_without_complex + class_eval <<~EVAL + prepend(Module.new do + def #{scope} + if new_record? || @#{scope}_cached + @#{scope} ||= [] + else + @#{scope}_cached = true + @#{scope} = super + end end - end - alias_method_chain :#{scope}, :complex + end) EVAL end end @@ -209,7 +208,7 @@ def attributes # remove all dirty tracking for the object and return self for chaining. def clear_changed_attributes! - @changed_attributes = {} + clear_changes_information self end @@ -218,4 +217,4 @@ def remote_name self.class.name.base_name end end -end +end \ No newline at end of file diff --git a/lib/zuora/objects/amendment.rb b/lib/zuora/objects/amendment.rb index a1d2477c..4269ff32 100644 --- a/lib/zuora/objects/amendment.rb +++ b/lib/zuora/objects/amendment.rb @@ -42,7 +42,7 @@ def apply_response(response_hash, type) self.invoice_id = result[:invoice_id] self.payment_transaction_number = result[:payment_transaction_number] @previously_changed = changes - @changed_attributes.clear + clear_changes_information return true else self.errors.add(:base, result[:errors][:message]) diff --git a/lib/zuora/objects/base.rb b/lib/zuora/objects/base.rb index 6de13553..3ce8745c 100644 --- a/lib/zuora/objects/base.rb +++ b/lib/zuora/objects/base.rb @@ -44,7 +44,7 @@ def reload! self.send("#{k}=", v) } @previously_changed = changes - @changed_attributes.clear + clear_changes_information self end @@ -84,9 +84,9 @@ def self.select(select) def self.all keys = (attributes - unselectable_attributes).map(&:to_s).map(&:zuora_camelize) sql = "select #{keys.join(', ')} from #{remote_name}" - + result = self.connector.query(sql) - + generate(result.to_hash, :query_response) end @@ -191,7 +191,7 @@ def apply_response(response_hash, type) if result[:success] self.id = result[:id] @previously_changed = changes - @changed_attributes.clear + clear_changes_information return true else raise StandardError.new(result[:errors][:message]) diff --git a/lib/zuora/objects/subscribe_request.rb b/lib/zuora/objects/subscribe_request.rb index cfbf937a..0dd56996 100644 --- a/lib/zuora/objects/subscribe_request.rb +++ b/lib/zuora/objects/subscribe_request.rb @@ -55,7 +55,7 @@ def apply_response(response_hash, type) subscription.name = result[:subscription_number] subscription.clear_changed_attributes! @previously_changed = changes - @changed_attributes.clear + clear_changes_information else self.errors.add(:base, result[:errors][:message]) end diff --git a/lib/zuora/validations.rb b/lib/zuora/validations.rb index 73db86f2..a09c1233 100644 --- a/lib/zuora/validations.rb +++ b/lib/zuora/validations.rb @@ -9,7 +9,7 @@ def self.included(base) class DateTimeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless [DateTime, Time].any? { |klass| value.is_a?(klass) } - record.errors[attribute] << (options[:message] || "is not a valid datetime") + record.errors.add(attribute, (options[:message] || "is not a valid datetime")) end end end @@ -17,7 +17,7 @@ def validate_each(record, attribute, value) class DateValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless [Date].any? { |klass| value.is_a?(klass) } - record.errors[attribute] << (options[:message] || "is not a valid date") + record.errors.add(attribute, (options[:message] || "is not a valid date")) end end end 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 dc320348..c8c96bdc 100644 --- a/zuora.gemspec +++ b/zuora.gemspec @@ -20,23 +20,24 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.extra_rdoc_files = ['README.md'] - s.add_dependency 'activemodel', '~> 5.0.7' - s.add_dependency 'activesupport', '~> 5.0.7' - s.add_dependency 'httpi' - s.add_dependency 'i18n', '~> 1.5.1' - s.add_dependency 'libxml4r', '~> 0.2.6' - s.add_dependency 'savon', '~> 2.15.0' - s.add_development_dependency 'artifice', '~> 0.6.0' - s.add_development_dependency 'bigdecimal', '~> 3.0.0' - s.add_development_dependency 'factory_girl', '~> 2.6.4' - s.add_development_dependency 'guard-rspec', '~> 0.6.0' + s.add_development_dependency 'appraisal' + s.add_development_dependency 'artifice' + s.add_development_dependency 'factory_bot' + s.add_development_dependency 'guard-rspec' s.add_development_dependency 'pry' + s.add_development_dependency 'pry-byebug' s.add_development_dependency 'pry-nav' - s.add_development_dependency 'rake', '~> 0.8.7' - 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' + s.add_development_dependency 'rake' + s.add_development_dependency 'redcarpet' + s.add_development_dependency 'rspec' + s.add_development_dependency 'simplecov' s.add_development_dependency 'test-unit' - s.add_development_dependency 'yard', '~> 0.7.5' + s.add_development_dependency 'yard' + s.add_dependency 'akami' + s.add_dependency 'httpi' + s.add_dependency 'libxml4r' + s.add_dependency 'nokogiri' + s.add_dependency 'rack' + s.add_dependency 'savon' + s.add_dependency 'wasabi' end