1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Merge pull request #340 from tatsuyafw/fix-broken-spec

Fix failed tests
This commit is contained in:
James Cox 2019-01-07 12:57:46 -05:00 committed by GitHub
commit 876e4702c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 671 additions and 8 deletions

View file

@ -12,7 +12,6 @@ gemfile:
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
- gemfiles/nobrainer.gemfile
# matrix:
# exclude:

View file

@ -126,7 +126,11 @@ EOS
out = @ap.awesome(@diana)
raw_object_string =
if activerecord_5_0?
if activerecord_5_2?
ActiveRecordData.raw_5_2_diana
elsif activerecord_5_1?
ActiveRecordData.raw_5_1_diana
elsif activerecord_5_0?
ActiveRecordData.raw_5_0_diana
elsif activerecord_4_2?
if RUBY_VERSION > '1.9.3'
@ -153,7 +157,11 @@ EOS
out = @ap.awesome([@diana, @laura])
raw_object_string =
if activerecord_5_0?
if activerecord_5_2?
ActiveRecordData.raw_5_2_multi
elsif activerecord_5_1?
ActiveRecordData.raw_5_1_multi
elsif activerecord_5_0?
ActiveRecordData.raw_5_0_multi
elsif activerecord_4_2?
if RUBY_VERSION > '1.9.3'
@ -225,7 +233,9 @@ class SubUser < User {
out = @ap.awesome(User.methods.grep(/first/))
if ActiveRecord::VERSION::STRING >= '3.2'
if RUBY_VERSION >= '1.9'
if RUBY_VERSION >= '2.5'
expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/)
elsif RUBY_VERSION >= '1.9'
expect(out).to match(/\sfirst\(\*args,\s&block\)\s+Class \(ActiveRecord::Querying\)/)
else
expect(out).to match(/\sfirst\(\*arg1\)\s+Class \(ActiveRecord::Querying\)/)
@ -236,7 +246,11 @@ class SubUser < User {
# spec 2
out = @ap.awesome(User.methods.grep(/primary_key/))
expect(out).to match(/\sprimary_key\(.*?\)\s+Class \(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/)
if RUBY_VERSION >= '2.5'
expect(out).to match(/\sprimary_key\(.*?\)\s+User/)
else
expect(out).to match(/\sprimary_key\(.*?\)\s+Class \(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/)
end
# spec 3
out = @ap.awesome(User.methods.grep(/validate/))
@ -244,7 +258,11 @@ class SubUser < User {
if ActiveRecord::VERSION::MAJOR < 3
expect(out).to match(/\svalidate\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/)
else
expect(out).to match(/\svalidate\(\*arg.*?\)\s+Class \(ActiveModel::Validations::ClassMethods\)/)
if RUBY_VERSION >= '2.5'
expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/)
else
expect(out).to match(/\svalidate\(\*arg.*?\)\s+Class \(ActiveModel::Validations::ClassMethods\)/)
end
end
end

View file

@ -7,12 +7,20 @@ RSpec.describe 'Single method' do
it 'plain: should handle a method with no arguments' do
method = ''.method(:upcase)
expect(method.ai(plain: true)).to eq('String#upcase()')
if RUBY_VERSION >= '2.4.0'
expect(method.ai(plain: true)).to eq('String#upcase(*arg1)')
else
expect(method.ai(plain: true)).to eq('String#upcase()')
end
end
it 'color: should handle a method with no arguments' do
method = ''.method(:upcase)
expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m")
if RUBY_VERSION >= '2.4.0'
expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m(*arg1)\e[0m")
else
expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m")
end
end
it 'plain: should handle a method with one argument' do

View file

@ -0,0 +1,104 @@
#<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveRecord::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = false
>,
"created_at" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
>,
"id" => #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Diana"
>,
"rank" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 1
>
}
>,
attr_accessor :destroyed_by_association = nil
>

View file

@ -0,0 +1,210 @@
[
[0] #<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveRecord::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = false
>,
"created_at" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
>,
"id" => #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Diana"
>,
"rank" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 1
>
}
>,
attr_accessor :destroyed_by_association = nil
>,
[1] #<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveRecord::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = true
>,
"created_at" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "2003-05-26 14:15:00"
>,
"id" => #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Laura"
>,
"rank" => #<ActiveRecord::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
@range = -2147483648...2147483648,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 2
>
}
>,
attr_accessor :destroyed_by_association = nil
>
]

View file

@ -0,0 +1,104 @@
#<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = false
>,
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
>,
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Diana"
>,
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 1
>
}
>,
attr_accessor :destroyed_by_association = nil
>

View file

@ -0,0 +1,210 @@
[
[0] #<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = false
>,
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
>,
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Diana"
>,
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 1
>
}
>,
attr_accessor :destroyed_by_association = nil
>,
[1] #<User:placeholder_id
@_start_transaction_state = {},
@aggregation_cache = {},
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@readonly = false,
@transaction_state = nil,
attr_accessor :attributes = #<ActiveModel::AttributeSet:placeholder_id
@attributes = {
"admin" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "admin",
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = true
>,
"created_at" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "created_at",
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "2003-05-26 14:15:00"
>,
"id" => #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "id",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
"name" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "name",
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = "Laura"
>,
"rank" => #<ActiveModel::Attribute::FromUser:placeholder_id
@original_attribute = #<ActiveModel::Attribute::FromDatabase:placeholder_id
@original_attribute = nil,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = nil
>,
attr_reader :name = "rank",
attr_reader :type = #<ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer:placeholder_id
@range = -9223372036854775808...9223372036854775808,
attr_reader :limit = nil,
attr_reader :precision = nil,
attr_reader :scale = nil
>,
attr_reader :value_before_type_cast = 2
>
}
>,
attr_accessor :destroyed_by_association = nil
>
]

View file

@ -3,6 +3,16 @@ module RailsVersions
Gem::Version.new(Rails::VERSION::STRING)
end
def rails_5_2?
Gem::Requirement.new('~> 5.2.0').satisfied_by?(rails_version)
end
alias_method :activerecord_5_2?, :rails_5_2?
def rails_5_1?
Gem::Requirement.new('~> 5.1.0').satisfied_by?(rails_version)
end
alias_method :activerecord_5_1?, :rails_5_1?
def rails_5_0?
Gem::Requirement.new('~> 5.0.0.racecar1').satisfied_by?(rails_version)
end