forked from zuorasc/zuora
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
136 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,5 @@ def client | |
http.auth.ssl.verify_mode = :none | ||
end | ||
end | ||
|
||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require 'scanf' | ||
# require 'scanf' | ||
|
||
module Zuora | ||
class Version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,54 @@ | ||
require 'spec_helper' | ||
|
||
describe "Subscription" do | ||
|
||
describe 'Subscription' do | ||
before :each do | ||
authenticate! | ||
@account = FactoryGirl.create(:active_account, :account_number => generate_key) | ||
@product = FactoryGirl.create(:product_catalog, :name => generate_key) | ||
allow_any_instance_of(Zuora::Api).to receive(:authenticate!).and_return(true) | ||
require 'pry' | ||
@account = FactoryGirl.create(:active_account, account_number: generate_key) | ||
@product = FactoryGirl.create(:product_catalog, name: generate_key) | ||
end | ||
|
||
after :each do | ||
@account.destroy | ||
@product.destroy | ||
end | ||
|
||
it "can be created" do | ||
payment_method = FactoryGirl.create(:payment_method_credit_card, :account => @account) | ||
it 'can be created' do | ||
payment_method = FactoryGirl.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 = FactoryGirl.build(:subscription, account: @account) | ||
|
||
request = Zuora::Objects::SubscribeRequest.new( | ||
:account => @account, | ||
:bill_to_contact => bill_to_contact, | ||
:payment_method => payment_method, | ||
:product_rate_plan => product_rate_plan, | ||
:subscription => subscription | ||
account: @account, | ||
bill_to_contact: bill_to_contact, | ||
payment_method: payment_method, | ||
product_rate_plan: product_rate_plan, | ||
subscription: subscription | ||
) | ||
|
||
request.should be_valid | ||
request.create.should == true | ||
expect(request).to be_valid | ||
expect(request.create).to be_truthy | ||
|
||
subscriptions = @account.subscriptions | ||
subscriptions.size.should == 1 | ||
expect(subscriptions.size).to eq(1) | ||
|
||
subscription = subscriptions.first | ||
subscription.should be_valid | ||
expect(subscription).to be_valid | ||
|
||
rps = subscription.rate_plans | ||
rps.size.should == 1 | ||
expect(rps.size).to eq(1) | ||
rp = rps.first | ||
rp.should be_valid | ||
expect(rp).to be_valid | ||
|
||
rpcs = rp.rate_plan_charges | ||
rpcs.size.should == 1 | ||
rpcs.first.should be_valid | ||
expect(rpcs.size).to eq(1) | ||
expect(rpcs.first).to be_valid | ||
|
||
@account.invoices.size.should == 1 | ||
expect(@account.invoices.size).to eq(1) | ||
invoice = @account.invoices.first | ||
invoice.invoice_item_adjustments.should == [] | ||
invoice.invoice_items.size.should == 1 | ||
invoice.invoice_adjustments.should == [] | ||
expect(invoice.invoice_item_adjustments).to match_array([]) | ||
expect(invoice.invoice_items.size).to eq(1) | ||
expect(invoice.invoice_adjustments).to match_array([]) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
def authenticate! | ||
Zuora.configure(:username => ENV['ZUORA_USER'], :password => ENV['ZUORA_PASS']) | ||
Zuora.configure(username: ENV['ZUORA_USER'], password: ENV['ZUORA_PASS']) | ||
Zuora::Api.instance.authenticate! | ||
Zuora::Api.instance.should be_authenticated | ||
rescue Zuora::Fault => e | ||
fail "Unable to authenticate. Please see the documentation regarding live testing configuration." | ||
raise 'Unable to authenticate. Please see the documentation regarding live testing configuration.' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
class SomeExampleObject < Zuora::Objects::Base | ||
end | ||
|
||
class SomeExampleConnector | ||
def initialize(model) | ||
end | ||
def initialize(model); end | ||
end | ||
|
||
describe Zuora::Objects::Base do | ||
describe :connector do | ||
it "uses SoapConnector by default" do | ||
describe ':connector' do | ||
it 'uses SoapConnector by default' do | ||
SomeExampleObject.connector.should be_a Zuora::SoapConnector | ||
end | ||
|
||
it "allows injecting different class for tests" do | ||
it 'allows injecting different class for tests' do | ||
described_class.connector_class = SomeExampleConnector | ||
SomeExampleObject.connector.should be_a SomeExampleConnector | ||
#reset for subsequent tests | ||
# reset for subsequent tests | ||
described_class.connector_class = Zuora::SoapConnector | ||
end | ||
end | ||
|
||
describe :initializer do | ||
it "allows to overwrite default values" do | ||
Zuora::Objects::Invoice.new.includes_usage.should be_true | ||
Zuora::Objects::Invoice.new(:includes_usage => false).includes_usage.should be_false | ||
describe ':initializer' do | ||
it 'allows to overwrite default values' do | ||
expect(Zuora::Objects::Invoice.new.includes_usage).to be_truthy | ||
expect(Zuora::Objects::Invoice.new(includes_usage: false).includes_usage).to be_falsy | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.