spec/integration/orders/placement_spec.rb in ib-ruby-0.7.3 vs spec/integration/orders/placement_spec.rb in ib-ruby-0.7.4

- old
+ new

@@ -1,9 +1,11 @@ require 'order_helper' #OPTS[:silent] = false + describe 'Orders', :connected => true, :integration => true do + let(:contract_type) { :stock } before(:all) { verify_account } context 'Placing wrong order', :slow => true do @@ -58,11 +60,11 @@ end it { @ib.received[:OpenOrder].should have_at_least(1).open_order_message } it { @ib.received[:OrderStatus].should have_exactly(0).status_messages } - it 'returns as what-if Order with margin and commission info' do + it 'responds with margin and commission info' do order_should_be /PreSubmitted/ order = @ib.received[:OpenOrder].first.order order.what_if.should == true order.equity_with_loan.should be_a Float order.init_margin.should be_a Float @@ -72,26 +74,24 @@ order.init_margin.should be > 0 order.maint_margin.should be > 0 order.commission.should be > 1 end - it 'is not actually opened though' do + it 'is not actually being placed though' do @ib.clear_received @ib.send_message :RequestOpenOrders @ib.wait_for :OpenOrderEnd @ib.received[:OpenOrder].should have_exactly(0).order_message end end - context 'Off-market stock order' do + context 'Off-market limit' do before(:all) do @ib = IB::Connection.new OPTS[:connection].merge(:logger => mock_logger) @ib.wait_for :NextValidId - - place_order IB::Symbols::Stocks[:wfc], - :limit_price => 9.13 # Set acceptable price - @ib.wait_for [:OpenOrder, 3], [:OrderStatus, 2] + place_order IB::Symbols::Stocks[:wfc], :limit_price => 9.13 # Acceptable price + @ib.wait_for [:OpenOrder, 3], [:OrderStatus, 2], 10 end after(:all) { close_connection } it_behaves_like 'Placed Order' @@ -118,7 +118,7 @@ alert = @ib.received[:Alert].first alert.should be_an IB::Messages::Incoming::Alert alert.message.should =~ /Can't find order with id =/ end end # Cancelling - end # Off-market order + end # Off-market limit end # Orders