Skip to content

Commit

Permalink
Merge pull request #20 from IkoroVictor/travis-test-fix
Browse files Browse the repository at this point in the history
- Fix Travis CI tests and updated dependencies
  • Loading branch information
IkoroVictor authored Apr 5, 2021
2 parents 935270f + d2f466f commit 04f5e7a
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/pkg/
/spec/reports/
/tmp/
/vendor
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
language: ruby
rvm:
- 2.0.0
- 2.4.0
before_install: gem install bundler
cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion lib/paystack/objects/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(paystackObj)
def self.initGetRequest(paystackObj, url)
result = nil
begin
response = RestClient.get "#{API::BASE_URL}#{url}" , :Authorization => "Bearer #{paystackObj.private_key}", :content_type => :json, :accept => :json
response = RestClient.get "#{API::BASE_URL}#{url}" , :Authorization => "Bearer #{paystackObj.private_key}", :content_type => :json, :accept => :json
unless (response.code == 200 || response.code == 201)
raise PaystackServerError.new(response), "HTTP Code #{response.code}: #{response.body}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/paystack/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Paystack
VERSION = "0.1.7"
VERSION = "0.1.10"
end
2 changes: 1 addition & 1 deletion paystack.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

#Dev dependencies
spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "bundler", "~> 2.2"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency 'rspec', '~> 3.0'

Expand Down
4 changes: 2 additions & 2 deletions spec/paystack_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

describe PaystackCard do
it "should be valid" do
card = PaystackCard.new(:name => 'Victor Ikoro', :number => '4123450131001381', :cvc => '883', :expiryMonth => '09', :expiryYear => '19')
card = PaystackCard.new(:name => 'Victor Ikoro', :number => '4123450131001381', :cvc => '883', :expiryMonth => '09', :expiryYear => '24')
expect(card.isValidCard).to eq true
end

it "should be invalid" do
card = PaystackCard.new(:name => 'Victor Ikoro', :number => '9343450131001381', :cvc => '883', :expiryMonth => '09', :expiryYear => '19')
card = PaystackCard.new(:name => 'Victor Ikoro', :number => '9343450131001381', :cvc => '883', :expiryMonth => '09', :expiryYear => '24')
expect(card.isValidCard).to eq false
end

Expand Down
5 changes: 3 additions & 2 deletions spec/paystack_customers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
list = customers.list(1)
expect(list.nil?).to eq false
temp = list["data"][0]
hash=customers.get(temp['id'])
puts temp.inspect
hash=customers.get(temp['customer_code'])
expect(hash.nil?).to eq false
expect(hash['data']['id'].nil?).to eq false
expect(hash['data']['customer_code'].nil?).to eq false
end

it "should successfuly update a customer" do
Expand Down
2 changes: 1 addition & 1 deletion spec/paystack_plans_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
:name => "Test Plan Updated",
:description => "Dev Test Plan Updated",
:amount => 30000, #in KOBO
:interval => "monthly",
#:interval => "monthly",
:currency => "NGN"
)
puts hash
Expand Down
12 changes: 6 additions & 6 deletions spec/paystack_recipients_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
expect(list.nil?).to eq false
end

it "should successfuly create a recipient" do
#Skipping test as it requires nuban account validation and test payment accounts do not work
xit "should successfuly create a recipient" do
paystack = Paystack.new(public_test_key, private_test_key)
recipients = PaystackRecipients.new(paystack)
expect(recipients.nil?).to eq false
temp = Random.new_seed.to_s
temp = "Random.new_seed.to_s"
hash=recipients.create(
:type => "nuban", #Must be nuban
:name => "#{temp[0..2]} Test Plan",
:description => "Dev Test Plan Updated",
:account_number => temp[0..9], #10 digit account number
:bank_code => "044", #monthly, yearly, quarterly, weekly etc
:description => "Dev Test Receipt transfer",
:account_number => "0000000000", #10 digit account number
:bank_code => "011", #First bank
:currency => "NGN",

)
puts hash
expect(hash.nil?).to eq false
Expand Down
2 changes: 1 addition & 1 deletion spec/paystack_subaccounts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
subaccounts = PaystackSubaccounts.new(paystack)
expect(subaccounts.nil?).to eq false
temp = Random.new_seed.to_s
hash=subaccounts.create(:business_name => "#{temp[0..6]}-business", :settlement_bank => "Access Bank", :account_number => "01234567890", :percentage_charge => 2.5)
hash=subaccounts.create(:business_name => "#{temp[0..6]}-business", :settlement_bank => "011", :account_number => "0000000000", :percentage_charge => 2.5)
puts hash
expect(hash.nil?).to eq false
expect(hash['data']['id'].nil?).to eq false
Expand Down
3 changes: 2 additions & 1 deletion spec/paystack_subscriptions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
expect(hash['status']).to eq true
end

it "should successfully enable a subscription" do
#Skipping test as cancelled subscriptions cannot be re-enabled
xit "should successfully enable a subscription" do
paystack = Paystack.new(public_test_key, private_test_key)
subscriptions = PaystackSubscriptions.new(paystack)
plans = PaystackPlans.new(paystack)
Expand Down
2 changes: 1 addition & 1 deletion spec/paystack_transactions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
#TODO: Manually get valid reference for this test
# i.e Initailize transaction with your reference, redirect to authorization url, fill card details,
# if transaction successful, replace your reference with the value below
reference = "2425847597"
reference = "c2v7vxelg2"

paystack = Paystack.new(public_test_key, private_test_key)
transactions = PaystackTransactions.new(paystack)
Expand Down

0 comments on commit 04f5e7a

Please sign in to comment.