spec/model_helper.rb in ib-ruby-0.8.4 vs spec/model_helper.rb in ib-ruby-0.8.5

- old
+ new

@@ -69,18 +69,18 @@ def buy_sell_assigns {['BOT', 'BUY', 'Buy', 'buy', :BUY, :BOT, :Buy, :buy, 'B', :b] => :buy, ['SELL', 'SLD', 'Sel', 'sell', :SELL, :SLD, :Sell, :sell, 'S', :S] => :sell, [1, nil, 'ASK', :foo] => /should be buy.sell/ - } + } end def buy_sell_short_assigns buy_sell_assigns.merge( - ['SSHORT', 'Short', 'short', :SHORT, :short, 'T', :T] => :short, - ['SSHORTX', 'Shortextemt', 'shortx', :short_exempt, 'X', :X] => :short_exempt, - [1, nil, 'ASK', :foo] => /should be buy.sell.short/) + ['SSHORT', 'Short', 'short', :SHORT, :short, 'T', :T] => :short, + ['SSHORTX', 'Shortextemt', 'shortx', :short_exempt, 'X', :X] => :short_exempt, + [1, nil, 'ASK', :foo] => /should be buy.sell.short/) end def test_assigns cases, prop, name # For all test cases given as an Array [res1, res2] or Hash {val => res} ... @@ -94,21 +94,21 @@ case result when Exception # ... Exception it "#{prop} = #{value.inspect} #=> raises #{result}" do expect { subject.send "#{prop}=", value }. - to raise_error result + to raise_error result end when Regexp # ... Non-exceptional error, making model invalid it "#{prop} = #{value.inspect} #=> error #{result.to_s}" do expect { subject.send "#{prop}=", value }.to_not raise_error subject.valid? # just triggers validation - #pp subject.errors.messages + #pp subject.errors.messages subject.errors.messages.should have_key name subject.should be_invalid msg = subject.errors.messages[name].find { |msg| msg =~ result } msg.should =~ result @@ -196,11 +196,11 @@ let(:init_with_props?) { false } it { should_not be_nil } it 'sets all properties to defaults' do subject.default_attributes.each do |name, value| - #p name, value + # p name, subject.send(name), value case value when Time subject.send(name).should be_a Time else subject.send(name).should == value @@ -214,11 +214,12 @@ shared_examples_for 'Model instantiated with properties' do let(:init_with_props?) { true } it 'auto-assigns all properties given to initializer' do + # p subject props.each do |name, value| - #p subject, name, value + # p name, subject.send(name), value subject.send(name).should == value end end it 'has correct human-readeable format' do