test/spec/fees_spec.rb in openpay-1.0.10 vs test/spec/fees_spec.rb in openpay-2.0.0b
- old
+ new
@@ -33,23 +33,23 @@
describe '.create' do
#In order to create a fee a charge should exists
it 'creates a fee ' do
#create new customer
- customer_hash= FactoryGirl.build(:customer)
+ customer_hash= FactoryBot.build(:customer)
customer=@customers.create(customer_hash)
#create customer card
- card_hash=FactoryGirl.build(:valid_card)
+ card_hash=FactoryBot.build(:valid_card)
card=@cards.create(card_hash, customer['id'])
#create charge
- charge_hash=FactoryGirl.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
+ charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
@charges.create(charge_hash, customer['id'])
-
+ sleep(50)
#create customer fee
- fee_hash = FactoryGirl.build(:fee, customer_id: customer['id'])
+ fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
@fees.create(fee_hash)
#performs check
expect(@fees.all.first['customer_id']).to match customer['id']
@@ -59,20 +59,21 @@
end
it 'creates a fee using a json message' do
#create new customer
- customer_hash= FactoryGirl.build(:customer)
+ customer_hash= FactoryBot.build(:customer)
customer=@customers.create(customer_hash)
#create customer card
- card_hash=FactoryGirl.build(:valid_card)
+ card_hash=FactoryBot.build(:valid_card)
card=@cards.create(card_hash, customer['id'])
#create charge
- charge_hash=FactoryGirl.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
+ charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
@charges.create(charge_hash, customer['id'])
+ sleep(50)
#create customer fee using json
fee_json =%^{"customer_id":"#{customer['id']}","amount":"12.50","description":"Cobro de Comision"}^
#performs check , it returns json
expect(@fees.create(fee_json)).to have_json_path('amount')
@@ -88,33 +89,35 @@
expect(fee['description']).to match /\s+/
end
end
end
-
+
describe '.list' do
it 'list fees with a given filter' do
#create new customer
- customer_hash= FactoryGirl.build(:customer)
+ customer_hash= FactoryBot.build(:customer)
customer=@customers.create(customer_hash)
#create customer card
- card_hash=FactoryGirl.build(:valid_card)
+ card_hash=FactoryBot.build(:valid_card)
card=@cards.create(card_hash, customer['id'])
#create charge
- charge_hash=FactoryGirl.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
+ charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
@charges.create(charge_hash, customer['id'])
+ sleep(50)
#create customer fee
- fee_hash = FactoryGirl.build(:fee, customer_id: customer['id'])
+ fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
@fees.create(fee_hash)
+ sleep(50)
#create customer fee
- fee_hash = FactoryGirl.build(:fee, customer_id: customer['id'])
+ fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
@fees.create(fee_hash)
#performs check
search_params = OpenpayUtils::SearchParams.new
@@ -133,22 +136,23 @@
describe '.all' do
it 'get all fees' do
#create new customer
- customer_hash= FactoryGirl.build(:customer)
+ customer_hash= FactoryBot.build(:customer)
customer=@customers.create(customer_hash)
#create customer card
- card_hash=FactoryGirl.build(:valid_card)
+ card_hash=FactoryBot.build(:valid_card)
card=@cards.create(card_hash, customer['id'])
#create charge
- charge_hash=FactoryGirl.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
+ charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
@charges.create(charge_hash, customer['id'])
+ sleep(50)
#create customer fee
- fee_hash = FactoryGirl.build(:fee, customer_id: customer['id'])
+ fee_hash = FactoryBot.build(:fee, customer_id: customer['id'])
@fees.create(fee_hash)
#performs check
expect(@fees.all.first['amount']).to be_a Float