Sha256: ae910ad169b88bdcdb8f9fb2e6d3b7e7888766a46b698acf02485d68df12a6a6

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

describe Plaid::Transaction do
  # API: semi-private
  describe '.new' do
    # The reason this looks weird is because it is. This will be refactored for 2.0
    subject { Plaid::Transaction.new(results) }

    def self.with_results(_results, &examples)
      context "with results #{_results}" do
        let(:results) { _results }
        instance_eval(&examples)
      end
    end

    with_results('_id'      =>  'ID')       do it { expect(subject.id).to       eql('ID') }       end
    with_results('_account' =>  'acct')     do it { expect(subject.account).to  eql('acct') }     end
    with_results('date'     => '00/00/00')  do it { expect(subject.date).to     eql('00/00/00') } end
    with_results('amount'   => 100.00)      do it { expect(subject.amount).to   eql(100.00) }     end
    with_results('name'     =>  'Name')     do it { expect(subject.name).to     eql('Name') }     end
    with_results('meta'     => {} )         do it { expect(subject.meta).to     eql({}) }         end
    with_results('meta'     => {'location' => 'Location'}) do it { expect(subject.location).to eql('Location') } end
    with_results('pending'  =>  true)       do it { expect(subject.pending).to  eql(true) }       end
    with_results('score'    =>  200)        do it { expect(subject.score).to    eql(200) }        end
    with_results('type'     =>  'Type')     do it { expect(subject.type).to     eql('Type') }     end

    with_results('category'    => 'Category') do it { expect(subject.category).to    eql('Category') } end
    with_results('category_id' => 100)        do it { expect(subject.category_id).to eql(100) } end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
plaid-1.7.1 spec/plaid/models/transaction_spec.rb
plaid-1.7.0 spec/plaid/models/transaction_spec.rb
plaid-1.6.2 spec/transaction_spec.rb
plaid-1.6.1 spec/transaction_spec.rb
plaid-1.6.0 spec/transaction_spec.rb