Skip to content

Commit

Permalink
Rails 4 - ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgeorgeson committed Jun 19, 2024
1 parent 570cd42 commit 93936b3
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 105 deletions.
16 changes: 8 additions & 8 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/accounts.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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}" }
end

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"
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/contacts.rb
Original file line number Diff line number Diff line change
@@ -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
52 changes: 27 additions & 25 deletions spec/factories/payment_methods.rb
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions spec/factories/product_rate_plan_charge_tiers.rb
Original file line number Diff line number Diff line change
@@ -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
26 changes: 13 additions & 13 deletions spec/factories/product_rate_plan_charges.rb
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions spec/factories/product_rate_plans.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 9 additions & 9 deletions spec/factories/products.rb
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions spec/factories/subscriptions.rb
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions spec/integration/account_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/product_catalog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions spec/integration/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
20 changes: 10 additions & 10 deletions spec/zuora/objects/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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").
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Loading

0 comments on commit 93936b3

Please sign in to comment.