Skip to content

Commit

Permalink
Do not raise a TinyTds::Error with our message handler unless the sev…
Browse files Browse the repository at this point in the history
…erity is greater than 10.
  • Loading branch information
metaskills committed Jul 12, 2011
1 parent 0bd4130 commit a834eff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/result_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,21 @@ class ResultTest < TinyTds::TestCase
assert_equal [], @client.execute('').each
end

should 'not raise an error when severity is 10 or less' do
(1..10).to_a.each do |severity|
@client.execute("RAISERROR(N'Test #{severity} severity', #{severity}, 0)").do
end
end

should 'raise an error when severity is greater than 10' do
action = lambda { @client.execute("RAISERROR(N'Test 11 severity', 11, 0)").do }
assert_raise_tinytds_error(action) do |e|
assert_equal "Test 11 severity", e.message
assert_equal 11, e.severity
assert_equal 50000, e.db_error_number
end
end

should 'throw an error when you execute another query with other results pending' do
result1 = @client.execute(@query1)
action = lambda { @client.execute(@query1) }
Expand Down

0 comments on commit a834eff

Please sign in to comment.