Skip to content

Commit

Permalink
Fix running unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed May 22, 2017
1 parent 629a8cd commit 88c75e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/bbmb/model/order.rb
Expand Up @@ -259,7 +259,7 @@ def delete_invalid_positions
pos.total
false
rescue => error
SBSM.info "Deleting an invalid position from order #{order_id}"
SBSM.info "Deleting an invalid position from order #{order_id}" if defined?(SBSM)
true
end
end
Expand Down
7 changes: 2 additions & 5 deletions test/model/test_customer.rb
Expand Up @@ -25,17 +25,14 @@ def teardown
def test_email_writer
BBMB.server = flexmock('server')
@customer.instance_variable_set('@email', 'old@bbmb.ch')
BBMB.server.should_receive(:rename_user).and_return { |old, new|
assert_equal('old@bbmb.ch', old)
assert_equal('test@bbmb.ch', new)
}
BBMB.server.should_receive(:rename_user).once
@customer.email = 'test@bbmb.ch'
assert_equal('test@bbmb.ch', @customer.email)
end
def test_email_writer__nil
BBMB.server = flexmock('server')
@customer.instance_variable_set('@email', 'old@bbmb.ch')
assert_raises(RuntimeError) {
assert_raises(RuntimeError) {
@customer.email = nil
}
assert_equal('old@bbmb.ch', @customer.email)
Expand Down
3 changes: 2 additions & 1 deletion test/model/test_order.rb
Expand Up @@ -15,6 +15,7 @@ def setup
BBMB.config = $default_config.clone
@customer = flexmock("customer")
@customer.should_receive(:quota)
@customer.should_receive(:customer_id).and_return('customer_id')
@order = Order.new(@customer)
@position = flexmock('position')
@position.should_receive(:pcode).and_return(nil).by_default
Expand Down Expand Up @@ -65,7 +66,7 @@ def test_additional_info
@order.comment = 'Comment'
assert_equal({:comment => 'Comment'}, @order.additional_info)
@order.reference = '12345'
assert_equal({:comment => 'Comment', :reference => '12345'},
assert_equal({:comment => 'Comment', :reference => '12345'},
@order.additional_info)
@order.comment = nil
assert_equal({:reference => '12345'}, @order.additional_info)
Expand Down

0 comments on commit 88c75e3

Please sign in to comment.