aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-04 23:51:08 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-05 09:41:02 -0200
commit68782c1bf3b06c5b0d4a7d4c28b3bacb52824e9e (patch)
treec7eab0607ca78cbb25b8befc7e2ded6f29d55ac8 /activerecord/test/cases/adapters
parent0102c817bfb8ca6810732e02a6eee888935a1b92 (diff)
downloadrails-68782c1bf3b06c5b0d4a7d4c28b3bacb52824e9e.tar.gz
rails-68782c1bf3b06c5b0d4a7d4c28b3bacb52824e9e.tar.bz2
rails-68782c1bf3b06c5b0d4a7d4c28b3bacb52824e9e.zip
Use better variable names for ltree tests, remove instance variable
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r--activerecord/test/cases/adapters/postgresql/datatype_test.rb1
-rw-r--r--activerecord/test/cases/adapters/postgresql/ltree_test.rb25
2 files changed, 12 insertions, 14 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb
index 06e0983780..b628b0cd90 100644
--- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb
@@ -100,6 +100,7 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase
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
diff --git a/activerecord/test/cases/adapters/postgresql/ltree_test.rb b/activerecord/test/cases/adapters/postgresql/ltree_test.rb
index 20228d1fc4..5d12ca75ca 100644
--- a/activerecord/test/cases/adapters/postgresql/ltree_test.rb
+++ b/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 PostgresqlLtreeTest < ActiveRecord::TestCase
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 @@ class PostgresqlLtreeTest < ActiveRecord::TestCase
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