mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Migrate fabricators to factory bot factories (#626)
* Remove factory_girl include from dev rake task
No longer needed after 92b125b4a7
* Add missing factories
* Use FactoryBot factories instead of fabricators
* Remove all fabricators
* Remove unused method
* Remove fabrication gem
* Rename FactoryGirl to FactoryBot
https://robots.thoughtbot.com/factory_bot
This commit is contained in:
parent
acfe0552fc
commit
2da578a437
88 changed files with 356 additions and 610 deletions
|
@ -19,8 +19,8 @@ describe BankTransaction do
|
|||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@bank_transaction = Fabricate(:bank_transaction)
|
||||
Fabricate(:eis)
|
||||
@bank_transaction = create(:bank_transaction)
|
||||
create(:registrar)
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
|
@ -29,27 +29,27 @@ describe BankTransaction do
|
|||
end
|
||||
|
||||
it 'should be valid twice' do
|
||||
@bank_transaction = Fabricate(:bank_statement)
|
||||
@bank_transaction = create(:bank_statement)
|
||||
@bank_transaction.valid?
|
||||
@bank_transaction.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should not bind transaction with mismatching sums' do
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
r = create(:registrar, reference_no: 'RF7086666663')
|
||||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
bt = Fabricate(:bank_transaction, { sum: 10 })
|
||||
bt = create(:bank_transaction, { sum: 10 })
|
||||
bt.bind_invoice(invoice.number)
|
||||
|
||||
bt.errors.full_messages.should match_array(["Invoice and transaction sums do not match"])
|
||||
end
|
||||
|
||||
it 'should not bind transaction with cancelled invoice' do
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
r = create(:registrar, reference_no: 'RF7086666663')
|
||||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
invoice.cancel
|
||||
|
||||
bt = Fabricate(:bank_transaction, { sum: 240 })
|
||||
bt = create(:bank_transaction, { sum: 240 })
|
||||
bt.bind_invoice(invoice.number)
|
||||
|
||||
bt.errors.full_messages.should match_array(["Cannot bind cancelled invoice"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue