mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
starting sql bypass test, fixing create_table and drop_table!
This commit is contained in:
@@ -217,17 +217,17 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def create_table!
|
||||
@@connection.execute <<-end_sql
|
||||
connection.execute <<-end_sql
|
||||
CREATE TABLE #{table_name} (
|
||||
id INTEGER PRIMARY KEY,
|
||||
#{@@connection.quote_column_name(session_id_column)} TEXT UNIQUE,
|
||||
#{@@connection.quote_column_name(data_column)} TEXT
|
||||
#{connection.quote_column_name(session_id_column)} TEXT UNIQUE,
|
||||
#{connection.quote_column_name(data_column)} TEXT
|
||||
)
|
||||
end_sql
|
||||
end
|
||||
|
||||
def drop_table!
|
||||
@@connection.execute "DROP TABLE #{table_name}"
|
||||
connection.execute "DROP TABLE #{table_name}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
22
activerecord/test/cases/session_store/sql_bypass.rb
Normal file
22
activerecord/test/cases/session_store/sql_bypass.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require 'cases/helper'
|
||||
require 'action_dispatch'
|
||||
require 'active_record/session_store'
|
||||
|
||||
module ActiveRecord
|
||||
class SessionStore
|
||||
class SqlBypassTest < ActiveRecord::TestCase
|
||||
def setup
|
||||
super
|
||||
Session.drop_table! if Session.table_exists?
|
||||
end
|
||||
|
||||
def test_create_table
|
||||
assert !Session.table_exists?
|
||||
SqlBypass.create_table!
|
||||
assert Session.table_exists?
|
||||
SqlBypass.drop_table!
|
||||
assert !Session.table_exists?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user