Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7']
ruby: ['2.7', '4.0']

steps:
- name: Checkout
Expand All @@ -30,4 +30,5 @@ jobs:
run: bundle exec rspec

- name: Rubocop
if: matrix.ruby == '2.7'
run: bundle exec rubocop
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

ruby '>= 2.4.0'

gem 'activerecord', '>= 4.2.5', '< 6', require: false
gem 'activerecord', '>= 4.2.5', '< 9', require: false
gem 'rake', require: false

group :development do
Expand All @@ -29,7 +29,6 @@ group :development, :test do
gem 'coveralls'

gem 'overcommit'
gem 'ruby_dep', '1.5.0'

platforms :mri, :mingw do
gem 'pry', require: false
Expand Down
2 changes: 1 addition & 1 deletion annotate.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|

s.specification_version = 4 if s.respond_to? :specification_version
s.add_runtime_dependency(%q<rake>, '>= 10.4', '< 14.0')
s.add_runtime_dependency(%q<activerecord>, ['>= 3.2', '< 8.0'])
s.add_runtime_dependency(%q<activerecord>, ['>= 3.2', '< 9.0'])

s.metadata = {
"bug_tracker_uri" => "https://github.com/ctran/annotate_models/issues/",
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/annotate/annotate_models_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3083,12 +3083,12 @@ class User < ActiveRecord::Base

it 'displays just the error message with trace disabled (default)' do
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true }.to output(a_string_including("Unable to deannotate #{@model_dir}/user.rb: oops")).to_stderr
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true }.not_to output(a_string_including("/user.rb:2:in `<class:User>'")).to_stderr
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true }.not_to output(%r{/user\.rb:2:in [`']<class:User>'}).to_stderr
end

it 'displays the error message and stacktrace with trace enabled' do
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true, trace: true }.to output(a_string_including("Unable to deannotate #{@model_dir}/user.rb: oops")).to_stderr
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true, trace: true }.to output(a_string_including("/user.rb:2:in `<class:User>'")).to_stderr
expect { AnnotateModels.remove_annotations model_dir: @model_dir, is_rake: true, trace: true }.to output(%r{/user\.rb:2:in [`']<class:User>'}).to_stderr
end
end

Expand Down
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
require 'annotate/constants'
require 'byebug'

# The `files` gem (test-only) still calls the `File.exists?` alias, which was
# removed in Ruby 3.2+. Restore it for the test run only.
class File
unless respond_to?(:exists?)
def self.exists?(path)
exist?(path)
end
end
end

RSpec.configure do |config|
config.order = 'random'
config.filter_run_when_matching :focus
Expand Down