spec/wallet_spec.rb in freee-0.0.4 vs spec/wallet_spec.rb in freee-0.1.0
- old
+ new
@@ -9,12 +9,14 @@
before(:each) do
Freee::Base.config(client_id, secret_key, token)
end
- it 'should can be able to create instance' do
- expect(wallet.list(company_id)).not_to be_nil
+ describe 'should can be able to create instance' do
+ subject { wallet.list(company_id) }
+ it { is_expected.not_to be_nil }
+ it { is_expected.to be_instance_of(Freee::Response::Wallet) }
end
describe 'should get information of wallet txns for the company' do
subject { wallet.list(company_id) }
@@ -33,7 +35,27 @@
it { is_expected.to include('due_amount') }
it { is_expected.to include('date') }
it { is_expected.to include('entry_side') }
it { is_expected.to include('walletable_type') }
it { is_expected.to include('walletable_id') }
+ end
+
+ describe 'should get information of first wallet txns with walletable type' do
+ subject do
+ result = wallet.list(company_id, walletable_type: 'bank_account')['wallet_txns']
+ result.map! { |x| x['walletable_type'] }
+ Set.new(result).length
+ end
+
+ it { is_expected.not_to be_nil }
+ it { is_expected.to eq 1 }
+ end
+
+ describe "should get information of one's wallet txns" do
+ subject do
+ wallet.list(company_id, limit: 2)['wallet_txns'].length
+ end
+
+ it { is_expected.not_to be_nil }
+ it { is_expected.to eq 2 }
end
end