Sha256: 3ea8eaa32c3099719b8f5d22cd610239acbcf140381c450321f411f7b87659bc

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'model_helper'

describe IB::Models::OrderState do

  let(:props) do
    {:local_id => 23,
     :perm_id => 173276893,
     :client_id => 1111,
     :parent_id => 0,
     :filled => 3,
     :remaining => 2,
     :last_fill_price => 0.5,
     :average_fill_price => 0.55,
     :why_held => 'child',

     :init_margin => 500.0,
     :maint_margin => 500.0,
     :equity_with_loan => 750.0,
     :commission_currency => 'USD',
     :commission => 1.2,
     :min_commission => 1,
     :max_commission => 1.5,
     :status => 'PreSubmitted',
     :warning_text => 'Oh noes!',
    }
  end

  # TODO: :presents => { Object => "Formatted"}
  let(:human) do
    "<OrderState: PreSubmitted #23/173276893 from 1111 filled 3/2 at 0.5/0.55 margin 500.0/500.0 equity 750.0 fee 1.2 why_held child warning Oh noes!>"
  end

  let(:errors) do
    {:status => ["must not be empty"],
    }
  end

  let(:assigns) do
    {[:status] =>
         {[nil, ''] => /must not be empty/,
          ['Zorro', :Zorro] => 'Zorro' }
    }
  end

  let(:aliases) do
    {[:local_id, :order_id] => numeric_or_nil_assigns,
     [:price, :last_fill_price] => float_or_nil_assigns,
     [:average_price, :average_fill_price] => float_or_nil_assigns,
    }
  end

  it_behaves_like 'Model'
  it_behaves_like 'Self-equal Model'

end # describe IB::Order

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ib-ruby-0.7.8 spec/ib-ruby/models/order_state_spec.rb