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

Added rails 6.0 and 6.1 tests to travis #396

Merged
merged 5 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ gemfile:
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
- gemfiles/rails_6.0.gemfile
- gemfiles/rails_6.1.gemfile
- gemfiles/mongoid_5.0.gemfile
- gemfiles/mongoid_6.0.gemfile

Expand Down
8 changes: 8 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ appraise 'rails-5.2' do
gem 'rails', '>= 5.2.0', '< 5.3'
end

appraise 'rails-6.0' do
gem 'rails', '>= 6.0.0', '< 6.1'
end

appraise 'rails-6.1' do
gem 'rails', '>= 6.1.0', '< 6.2'
end

appraise 'mongoid-4.0' do
gem 'mongoid', '~> 4.0.0'
end
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", ">= 6.0.0", "< 6.1"

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", ">= 6.1.0", "< 6.2"

gemspec path: "../"
7 changes: 5 additions & 2 deletions spec/ext/action_view_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
require 'spec_helper'

RSpec.describe 'AwesomePrint ActionView extensions', skip: -> { !ExtVerifier.has_rails? }.call do

before do
@view = ActionView::Base.new
@view = if rails_6_1?
ActionView::Base.new(ActionView::LookupContext.new([]), {}, {})
else
ActionView::Base.new
end
end

it "uses HTML and adds 'debug_dump' class to plain <pre> tag" do
Expand Down
12 changes: 10 additions & 2 deletions spec/ext/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@
out = @ap.awesome(@diana)

raw_object_string =
if activerecord_5_2?
if activerecord_6_1?
ActiveRecordData.raw_6_1_diana
elsif activerecord_6_0?
ActiveRecordData.raw_6_0_diana
elsif activerecord_5_2?
ActiveRecordData.raw_5_2_diana
elsif activerecord_5_1?
ActiveRecordData.raw_5_1_diana
Expand All @@ -143,7 +147,11 @@
out = @ap.awesome([@diana, @laura])

raw_object_string =
if activerecord_5_2?
if activerecord_6_1?
ActiveRecordData.raw_6_1_multi
elsif activerecord_6_0?
ActiveRecordData.raw_6_0_multi
elsif activerecord_5_2?
ActiveRecordData.raw_5_2_multi
elsif activerecord_5_1?
ActiveRecordData.raw_5_1_multi
Expand Down
6 changes: 5 additions & 1 deletion spec/ext/active_support_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
it 'should format ActiveSupport::TimeWithZone as regular Time' do
Time.zone = 'Eastern Time (US & Canada)'
time = Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone
expect(@ap.send(:awesome, time)).to eq("\e[0;32mSat, 10 Feb 2007 15:30:45 EST -05:00\e[0m")
if activerecord_6_1?
expect(@ap.send(:awesome, time)).to eq("\e[0;32mSat, 10 Feb 2007 15:30:45.000000000 EST -05:00\e[0m")
else
expect(@ap.send(:awesome, time)).to eq("\e[0;32mSat, 10 Feb 2007 15:30:45 EST -05:00\e[0m")
end
end

it 'should format HashWithIndifferentAccess as regular Hash' do
Expand Down
104 changes: 104 additions & 0 deletions spec/support/active_record_data/6_0_diana.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#<User:placeholder_id
@_start_transaction_state = nil,
@association_cache = {},
@destroyed = false,
@marked_for_destruction = false,
@new_record = true,
@primary_key = "id",
@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
>
Loading