Sha256: a674a7279ca34ebf23b7714cb4513c6623f6a144096b8f2ac6e8eb4d7a2532e2

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require File.dirname(__FILE__) + '/../../helper'

module AffiliateWindow
  module Models
    class TransactionSpec < MiniTest::Unit::TestCase

      Klass = ::AffiliateWindow::Models::Transaction

      describe Klass do
        
        before do
          FakeWeb.register_uri(:any, AffiliateWindow::Clients::AffiliateService::ENDPOINT_URL, :response => File.join(fixture_path, 'responses', 'get_transaction_list.xml'))
          Klass.account = account
        end

        it 'stores an account' do
          Klass.account.must_be_kind_of AffiliateWindow::Account
        end

        it 'returns a transaction list' do
          method = :get_transaction_list
          Klass.get_transaction_list(
            :d_start_date => Time.now - 3600 * 250,
            :d_end_date => Time.now,
            :s_date_type => 'validation'
          ).must_be_kind_of Savon::SOAP::Response
        end

        it 'returns transactions from today' do
          collection = Klass.today
          transaction = collection.first

          collection.must_be_kind_of Array
          transaction.must_be_kind_of Klass
          transaction.id.must_equal '59330775'
          
          transaction.transaction_parts.must_be_kind_of Array
          
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
affiliate-window-0.2.1.pre1 spec/affiliate_window/models/transaction_spec.rb