aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2017-12-05 19:16:11 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2017-12-05 21:09:29 +0000
commit29d081c47a43cc5d979836541cb73a816c95981d (patch)
tree445d007c0d6c2434ecaebc70a475da14a5501edb /activerecord
parent7efb4d23c1022108319add6218ae9d9284936ac5 (diff)
downloadrails-29d081c47a43cc5d979836541cb73a816c95981d.tar.gz
rails-29d081c47a43cc5d979836541cb73a816c95981d.tar.bz2
rails-29d081c47a43cc5d979836541cb73a816c95981d.zip
Execute `JsonAttributeTest` only if `supports_json?` returns `true`
Oracle enhanced adapter does not fully support JSON datatype then `supports_json?` returns `false`. I wanted to skip known failures and errors when tested with Oracle enhanced adapter.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/json_attribute_test.rb46
1 files changed, 24 insertions, 22 deletions
diff --git a/activerecord/test/cases/json_attribute_test.rb b/activerecord/test/cases/json_attribute_test.rb
index 63f3c77fc3..a6fd4f34dc 100644
--- a/activerecord/test/cases/json_attribute_test.rb
+++ b/activerecord/test/cases/json_attribute_test.rb
@@ -3,33 +3,35 @@
require "cases/helper"
require "cases/json_shared_test_cases"
-class JsonAttributeTest < ActiveRecord::TestCase
- include JSONSharedTestCases
- self.use_transactional_tests = false
+if ActiveRecord::Base.connection.supports_json?
+ class JsonAttributeTest < ActiveRecord::TestCase
+ include JSONSharedTestCases
+ self.use_transactional_tests = false
- class JsonDataTypeOnText < ActiveRecord::Base
- self.table_name = "json_data_type"
+ class JsonDataTypeOnText < ActiveRecord::Base
+ self.table_name = "json_data_type"
- attribute :payload, :json
- attribute :settings, :json
+ attribute :payload, :json
+ attribute :settings, :json
- store_accessor :settings, :resolution
- end
-
- def setup
- super
- @connection.create_table("json_data_type") do |t|
- t.text "payload"
- t.text "settings"
+ store_accessor :settings, :resolution
end
- end
- private
- def column_type
- :text
+ def setup
+ super
+ @connection.create_table("json_data_type") do |t|
+ t.text "payload"
+ t.text "settings"
+ end
end
- def klass
- JsonDataTypeOnText
- end
+ private
+ def column_type
+ :text
+ end
+
+ def klass
+ JsonDataTypeOnText
+ end
+ end
end