spec/kpm/unit_mysql/account_spec.rb in kpm-0.8.2 vs spec/kpm/unit_mysql/account_spec.rb in kpm-0.9.0
- old
+ new
@@ -35,11 +35,11 @@
it 'when initialized with defaults' do
expect(described_class.new).to be_an_instance_of(KPM::Account)
end
it 'when initialized with options' do
- account_class.should be_an_instance_of(KPM::Account)
+ expect(account_class).to be_an_instance_of(KPM::Account)
expect(account_class.instance_variable_get(:@killbill_api_key)).to eq(killbill_api_key)
expect(account_class.instance_variable_get(:@killbill_api_secret)).to eq(killbill_api_secret)
expect(account_class.instance_variable_get(:@killbill_user)).to eq(killbill_user)
expect(account_class.instance_variable_get(:@killbill_password)).to eq(killbill_password)
expect(account_class.instance_variable_get(:@killbill_url)).to eq(url)
@@ -56,11 +56,11 @@
expect { account_class.send(:fetch_export_data, account_id_invalid) }.to raise_error(Interrupt, 'Account id not found')
end
it 'when account id found' do
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
- expect { account_class.send(:fetch_export_data, account_id) }.not_to raise_error(Interrupt, 'Account id not found')
+ expect { account_class.send(:fetch_export_data, account_id) }.not_to raise_error
expect(account_class.send(:fetch_export_data, account_id)).to match(account_id)
end
end
end
@@ -97,16 +97,16 @@
describe '#export' do
include_context 'account'
context 'when exporting data' do
it 'when file created' do
- expect(File.exist?(account_class.send(:export, dummy_data))).to be_true
+ expect(File.exist?(account_class.send(:export, dummy_data))).to be_truthy
end
it 'when file contains account record' do
- expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{table_name}/)).to be_true
- expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{cols_names}/)).to be_true
+ expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{table_name}/)).to be_truthy
+ expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{cols_names}/)).to be_truthy
end
end
end
describe '#export_data' do
@@ -117,17 +117,17 @@
expect { account_class.export_data }.to raise_error(Interrupt, 'Account id not found')
end
it 'when file created' do
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
- expect(File.exist?(account_class.export_data(account_id))).to be_true
+ expect(File.exist?(account_class.export_data(account_id))).to be_truthy
end
it 'when file contains account record' do
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
- expect(File.readlines(account_class.export_data(account_id)).grep(/#{table_name}/)).to be_true
- expect(File.readlines(account_class.export_data(account_id)).grep(/#{cols_names}/)).to be_true
+ expect(File.readlines(account_class.export_data(account_id)).grep(/#{table_name}/)).to be_truthy
+ expect(File.readlines(account_class.export_data(account_id)).grep(/#{cols_names}/)).to be_truthy
end
end
end
# import data tests
@@ -153,11 +153,11 @@
describe '#fix_dates' do
include_context 'account'
it 'when valid date value' do
- expect { DateTime.parse(account_class.send(:fix_dates, '2017-04-05T15:01:39.000+0000')) }.not_to raise_error(ArgumentError)
+ expect { DateTime.parse(account_class.send(:fix_dates, '2017-04-05T15:01:39.000+0000')) }.not_to raise_error
end
it 'when valid date value match YYYY-MM-DD HH:MM:SS' do
expect(account_class.send(:fix_dates, '2017-04-05T15:01:39.000+0000')).to match(/^\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}/)
end
@@ -305,11 +305,11 @@
it 'when importing data with new record_id' do
File.open(dummy_data_file, 'w') do |io|
io.puts(dummy_data)
end
- expect { account_class.import_data(dummy_data_file, nil, true, false, true) }.not_to raise_error(Interrupt)
+ expect { account_class.import_data(dummy_data_file, nil, true, false, true) }.not_to raise_error
verify_data(dummy_account_id)
row_count_inserted = delete_statement('accounts', 'id', dummy_account_id)
expect(row_count_inserted).to eq('1')
@@ -319,11 +319,11 @@
it 'when importing data reusing record_id' do
File.open(dummy_data_file, 'w') do |io|
io.puts(dummy_data)
end
- expect { account_class.import_data(dummy_data_file, nil, true, false, false) }.not_to raise_error(Interrupt)
+ expect { account_class.import_data(dummy_data_file, nil, true, false, false) }.not_to raise_error
verify_data(dummy_account_id)
row_count_inserted = delete_statement('accounts', 'id', dummy_account_id)
expect(row_count_inserted).to eq('1')
@@ -333,11 +333,11 @@
it 'when importing data with different tenant_record_id' do
File.open(dummy_data_file, 'w') do |io|
io.puts(dummy_data)
end
- expect { account_class.import_data(dummy_data_file, 10, true, false, true) }.not_to raise_error(Interrupt)
+ expect { account_class.import_data(dummy_data_file, 10, true, false, true) }.not_to raise_error
verify_data(dummy_account_id)
row_count_inserted = delete_statement('accounts', 'id', dummy_account_id)
expect(row_count_inserted).to eq('1')
@@ -347,10 +347,10 @@
it 'when round trip' do
File.open(dummy_data_file, 'w') do |io|
io.puts(dummy_data)
end
- expect { account_class.import_data(dummy_data_file, 10, true, true, true) }.not_to raise_error(Interrupt)
+ expect { account_class.import_data(dummy_data_file, 10, true, true, true) }.not_to raise_error
new_account_id = account_class.instance_variable_get(:@tables_id)
verify_data(new_account_id['accounts_id'])
row_count_inserted = delete_statement('accounts', 'id', new_account_id['accounts_id'])