Skip to content

Commit 5e54a22

Browse files
committed
Add new exclusion JSONBTest. Tweak some comments/names of variables.
1 parent ad0518a commit 5e54a22

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ task default: [:test]
1010
namespace :db do
1111
task "create_test_template" do
1212
ENV['DEBUG_COCKROACHDB_ADAPTER'] = "1"
13-
ENV['COCKROACH_SKIP_LOAD_SCHEMA'] = '1'
13+
ENV['COCKROACH_SKIP_LOAD_SCHEMA'] = "1"
1414
ENV["ARCONN"] = "cockroachdb"
1515

1616
TemplateCreator.connect

lib/active_record/connection_adapters/cockroachdb_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def initialize_type_map(m = type_map)
234234
precision = extract_precision(sql_type)
235235
scale = extract_scale(sql_type)
236236

237-
# If fmod is -1, that means that precision is defined, but not
238-
# scale or neither is defined.
237+
# If fmod is -1, that means that precision is defined but not
238+
# scale, or neither is defined.
239239
if fmod && fmod == -1
240240
# Below comment is from ActiveRecord
241241
# FIXME: Remove this class, and the second argument to

test/excludes/PostgresqlJSONBTest.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
exclude :test_changes_in_place_with_ruby_object, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2525
exclude :test_rewrite_array_json_value, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2626
exclude :test_type_cast_json, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
27+
exclude :test_pretty_print, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"

test/support/template_creator.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module TemplateCreator
77
# extend self
88

9-
CONNECTION_HASH = {
9+
DEFAULT_CONNECTION_HASH = {
1010
adapter: 'cockroachdb',
1111
database: 'defaultdb',
1212
port: 26257,
@@ -31,16 +31,12 @@ def template_db_name
3131
end
3232

3333
def connect(connection_hash=nil)
34-
connection_hash = CONNECTION_HASH if connection_hash.nil?
34+
connection_hash = DEFAULT_CONNECTION_HASH if connection_hash.nil?
3535
ActiveRecord::Base.establish_connection(connection_hash)
3636
end
3737

3838
def template_db_exists?
39-
if ActiveRecord::Base.connection.select_value("SELECT 1 FROM pg_database WHERE datname='#{template_db_name}'")
40-
true
41-
else
42-
false
43-
end
39+
ActiveRecord::Base.connection.select_value("SELECT 1 FROM pg_database WHERE datname='#{template_db_name}'") == 1
4440
end
4541

4642
def drop_template_db
@@ -64,7 +60,7 @@ def create_test_template
6460
create_template_db
6561

6662
# switch connection to template db
67-
conn = CONNECTION_HASH.dup
63+
conn = DEFAULT_CONNECTION_HASH.dup
6864
conn['database'] = template_db_name
6965
connect(conn)
7066

@@ -75,8 +71,6 @@ def create_test_template
7571
end
7672

7773
def restore_from_template
78-
# first, BACKUP the template_db
79-
# then RESTORE target from that backup.
8074
connect
8175
raise "The TemplateDB does not exist. Run 'rake db:create_test_template' first." unless template_db_exists?
8276

0 commit comments

Comments
 (0)