Sha256: 02e69d93b53cd56fa28b3b5c1a1034f628f2c6f9e4779fd1152347ab393b2193

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

require 'cases/sqlserver_helper'

class ExecuteProcedureTestSqlserver < ActiveRecord::TestCase
  
  def setup
    @klass = ActiveRecord::Base
  end
  
  should 'execute a simple procedure' do
    tables = @klass.execute_procedure :sp_tables
    assert_instance_of Array, tables
    assert_instance_of HashWithIndifferentAccess, tables.first
  end
  
  should 'take parameter arguments' do
    tables = @klass.execute_procedure :sp_tables, 'sql_server_chronics'
    table_info = tables.first
    assert_equal 1, tables.size
    assert_equal 'activerecord_unittest', table_info[:TABLE_QUALIFIER], "Table Info: #{table_info.inspect}"
    assert_equal 'TABLE', table_info[:TABLE_TYPE], "Table Info: #{table_info.inspect}"
  end
  
  should 'quote bind vars correctly' do
    assert_sql(/EXEC sp_tables '%sql_server%', NULL, NULL, NULL, 1/) do
      @klass.execute_procedure :sp_tables, '%sql_server%', nil, nil, nil, true
    end if sqlserver_2005?
    assert_sql(/EXEC sp_tables '%sql_server%', NULL, NULL, NULL/) do
      @klass.execute_procedure :sp_tables, '%sql_server%', nil, nil, nil
    end if sqlserver_2000?
  end
  
  
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
artpop-2000-2005-adapter-2.2.15 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.10 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.11 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.12 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.13 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.14 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.15 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.16 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.17 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.7 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.8 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.9 test/cases/execute_procedure_test_sqlserver.rb
rainux-2000-2005-adapter-2.2.15 test/cases/execute_procedure_test_sqlserver.rb