Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute JsonAttributeTest only if supports_json? returns true #31341

Merged
merged 1 commit into from
Dec 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 24 additions & 22 deletions activerecord/test/cases/json_attribute_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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