Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use better variable names for ltree tests, remove instance variable

  • Loading branch information...
commit 68782c1bf3b06c5b0d4a7d4c28b3bacb52824e9e 1 parent 0102c81
@carlosantoniodasilva carlosantoniodasilva authored
View
1  activerecord/test/cases/adapters/postgresql/datatype_test.rb
@@ -100,6 +100,7 @@ def test_data_type_of_network_address_types
assert_equal :inet, @first_network_address.column_for_attribute(:inet_address).type
assert_equal :macaddr, @first_network_address.column_for_attribute(:mac_address).type
end
+
def test_data_type_of_bit_string_types
assert_equal :string, @first_bit_string.column_for_attribute(:bit_string).type
assert_equal :string, @first_bit_string.column_for_attribute(:bit_string_varying).type
View
25 activerecord/test/cases/adapters/postgresql/ltree_test.rb
@@ -1,5 +1,4 @@
# encoding: utf-8
-
require "cases/helper"
require 'active_record/base'
require 'active_record/connection_adapters/postgresql_adapter'
@@ -11,16 +10,13 @@ class Ltree < ActiveRecord::Base
def setup
@connection = ActiveRecord::Base.connection
- begin
- @connection.transaction do
- @connection.create_table('ltrees') do |t|
- t.ltree 'path'
- end
+ @connection.transaction do
+ @connection.create_table('ltrees') do |t|
+ t.ltree 'path'
end
- rescue ActiveRecord::StatementInvalid
- return skip "do not test on PG without ltree"
end
- @column = Ltree.columns.find { |c| c.name == 'path' }
+ rescue ActiveRecord::StatementInvalid
+ skip "do not test on PG without ltree"
end
def teardown
@@ -28,17 +24,18 @@ def teardown
end
def test_column
- assert_equal :ltree, @column.type
+ column = Ltree.columns_hash['path']
+ assert_equal :ltree, column.type
end
def test_write
- x = Ltree.new(:path => '1.2.3.4')
- assert x.save!
+ ltree = Ltree.new(path: '1.2.3.4')
+ assert ltree.save!
end
def test_select
@connection.execute "insert into ltrees (path) VALUES ('1.2.3')"
- x = Ltree.first
- assert_equal('1.2.3', x.path)
+ ltree = Ltree.first
+ assert_equal '1.2.3', ltree.path
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.