Sha256: 97c0ca75506f835c007e0b4d6d659062036d56b3d858ff7b23ee62f4c65a7203

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 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? || sqlserver_2008?
    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
rails-sqlserver-2000-2005-adapter-2.2.18 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.19 test/cases/execute_procedure_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.21 test/cases/execute_procedure_test_sqlserver.rb
rainux-rails-sqlserver-2000-2005-2008-adapter-2.2.15 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.3 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.2 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.1 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.22 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.21 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.20 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.19 test/cases/execute_procedure_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.18 test/cases/execute_procedure_test_sqlserver.rb