Skip to content

Commit

Permalink
Ensure test database data is loaded before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andyundso committed Dec 18, 2024
1 parent 62fd9cd commit 1a3773a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
require 'test_helper'

class ClientTest < TinyTds::TestCase
before do
@@current_schema_loaded ||= load_current_schema
end

describe 'with valid credentials' do
before do
@client = new_connection
Expand Down Expand Up @@ -327,7 +331,7 @@ class ClientTest < TinyTds::TestCase
it 'has a #do method that cancels result rows and returns affected rows natively' do
rollback_transaction(@client) do
text = 'test affected rows native'
count = @client.execute("SELECT COUNT(*) AS [count] FROM [datatypes]").each.first['count']
count = @client.execute("SELECT COUNT(*) AS [count] FROM [datatypes]").first['count']
deleted_rows = @client.do("DELETE FROM [datatypes]")
assert_equal count, deleted_rows, 'should have deleted rows equal to count'
inserted_rows = @client.do("INSERT INTO [datatypes] ([varchar_50]) VALUES ('#{text}')")
Expand Down

0 comments on commit 1a3773a

Please sign in to comment.