diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a6d8ed8..8894b15 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,9 +17,9 @@ jobs: - name: Install the correct Ruby version uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 2.7 bundler-cache: true - rubygems: '3.3.26' + rubygems: '3.4.22' - name: Prepare the virtual environment uses: hausgold/actions/ci@master diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cf61fb..363bb30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,12 +20,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Ruby 2.5 + - name: Install Ruby 2.7 uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 2.7 bundler-cache: true - rubygems: '3.3.26' + rubygems: '3.4.22' - name: Prepare the virtual environment uses: hausgold/actions/ci@master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5f1452..20b0d6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.5', '2.7'] - rails: ['5.2'] + ruby: ['2.7'] + rails: ['5.2', '6.1', '7.1'] env: BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile' steps: @@ -30,7 +30,7 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - rubygems: '3.3.26' + rubygems: '3.4.22' - name: Prepare the virtual environment uses: hausgold/actions/ci@master diff --git a/.gitignore b/.gitignore index 040524f..81d25b0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /pkg/ /spec/reports/ /tmp/ +/log/ /vendor/ /gemfiles/vendor/ /Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml index a7212c9..27d7ea2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ AllCops: NewCops: enable SuggestExtensions: false DisplayCopNames: true - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.7 TargetRailsVersion: 5.2 Exclude: - bin/**/* diff --git a/Appraisals b/Appraisals index ebd48d2..4d93f65 100644 --- a/Appraisals +++ b/Appraisals @@ -3,3 +3,11 @@ appraise 'rails-5.2' do gem 'rails', '~> 5.2.0' end + +appraise 'rails-6.1' do + gem 'rails', '~> 6.1.0' +end + +appraise 'rails-7.1' do + gem 'rails', '~> 7.1.0' +end diff --git a/CHANGELOG.md b/CHANGELOG.md index b742b00..a7bffde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ### next -* TODO: Replace this bullet point with an actual description of a change. +* Dropped support for Ruby <2.7 (#20) ### 1.1.5 diff --git a/Dockerfile b/Dockerfile index def923e..13ccce4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM hausgold/ruby:2.5 +FROM hausgold/ruby:2.7 MAINTAINER Hermann Mayer # Update system gem -RUN gem update --system '3.3.26' +RUN gem update --system '3.4.22' # Install system packages and the latest bundler RUN apt-get update -yqqq && \ @@ -11,7 +11,7 @@ RUN apt-get update -yqqq && \ ca-certificates \ bash-completion inotify-tools && \ echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \ - gem install bundler -v '~> 2.3.0' --no-document --no-prerelease + gem install bundler -v '~> 2.4.22' --no-document --no-prerelease # Add new web user RUN mkdir /app && \ diff --git a/Makefile b/Makefile index f297618..d8e7767 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ test-style: \ test-style-ruby: # Run the static code analyzer (rubocop) @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \ - || ($(TEST) $$($(RUBY_VERSION)) != '2.5' && true)) + || ($(TEST) $$($(RUBY_VERSION)) != '2.7' && true)) clean: # Clean the dependencies diff --git a/app/controllers/factory_bot/instrumentation/root_controller.rb b/app/controllers/factory_bot/instrumentation/root_controller.rb index a99c12a..8eb4a9d 100644 --- a/app/controllers/factory_bot/instrumentation/root_controller.rb +++ b/app/controllers/factory_bot/instrumentation/root_controller.rb @@ -96,7 +96,7 @@ def instrumentation # # @return [Hash{String => Array}] the grouped scenarios def scenarios - res = (instrumentation['scenarios'] || []) + res = instrumentation['scenarios'] || [] res.each_with_object({}) do |scenario, memo| group = scenario_group(scenario['name']) scenario['group'] = group diff --git a/config/docker/.bashrc b/config/docker/.bashrc index 6884dc6..4942fcf 100644 --- a/config/docker/.bashrc +++ b/config/docker/.bashrc @@ -16,7 +16,9 @@ sudo sed -i 's/autostart=.*/autostart=false/g' /etc/supervisor/conf.d/* sudo supervisord >/dev/null 2>&1 & # Wait for supervisord -while ! supervisorctl status >/dev/null 2>&1; do sleep 1; done +while ! (sudo supervisorctl status | grep avahi) >/dev/null 2>&1; do + sleep 1 +done # Boot the mDNS stack echo '# Start the mDNS stack' diff --git a/factory_bot_instrumentation.gemspec b/factory_bot_instrumentation.gemspec index 915865a..3ce8c2f 100644 --- a/factory_bot_instrumentation.gemspec +++ b/factory_bot_instrumentation.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.5' + spec.required_ruby_version = '>= 2.7' # TODO: Remove the upper lock when # https://github.com/thoughtbot/factory_bot/issues/1614 is solved. diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile new file mode 100644 index 0000000..14fecc3 --- /dev/null +++ b/gemfiles/rails_6.1.gemfile @@ -0,0 +1,22 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4" +gem "bundler", "~> 2.3" +gem "countless", "~> 1.1" +gem "factory_bot_rails", "~> 6.2" +gem "guard-rspec", "~> 4.7" +gem "railties", ">= 5.2" +gem "rspec-rails", "~> 5.1" +gem "rubocop", "~> 1.28" +gem "rubocop-rails", "~> 2.14" +gem "rubocop-rspec", "~> 2.10" +gem "simplecov", ">= 0.22" +gem "sqlite3", "~> 1.5" +gem "timecop", ">= 0.9.6" +gem "yard", ">= 0.9.28" +gem "yard-activesupport-concern", ">= 0.0.1" +gem "rails", "~> 6.1.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 0000000..5045b46 --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -0,0 +1,22 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4" +gem "bundler", "~> 2.3" +gem "countless", "~> 1.1" +gem "factory_bot_rails", "~> 6.2" +gem "guard-rspec", "~> 4.7" +gem "railties", ">= 5.2" +gem "rspec-rails", "~> 5.1" +gem "rubocop", "~> 1.28" +gem "rubocop-rails", "~> 2.14" +gem "rubocop-rspec", "~> 2.10" +gem "simplecov", ">= 0.22" +gem "sqlite3", "~> 1.5" +gem "timecop", ">= 0.9.6" +gem "yard", ">= 0.9.28" +gem "yard-activesupport-concern", ">= 0.0.1" +gem "rails", "~> 7.1.0" + +gemspec path: "../" diff --git a/spec/controllers/factory_bot/instrumentation/root_controller_spec.rb b/spec/controllers/factory_bot/instrumentation/root_controller_spec.rb index 92bff1c..184ba1f 100644 --- a/spec/controllers/factory_bot/instrumentation/root_controller_spec.rb +++ b/spec/controllers/factory_bot/instrumentation/root_controller_spec.rb @@ -93,12 +93,12 @@ def main_app it 'responds the error' do action - expect(body['error']).to be_eql(%(Factory not registered: "admin")) + expect(body['error']).to eql(%(Factory not registered: "admin")) end it 'responds the application name' do action - expect(body['application']).to be_eql('Dummy') + expect(body['application']).to eql('Dummy') end context 'with custom error handling' do @@ -118,7 +118,7 @@ def main_app it 'responds the error message' do action - expect(body['error']).to be_eql(%(Factory not registered: "admin")) + expect(body['error']).to eql(%(Factory not registered: "admin")) end end end @@ -141,7 +141,7 @@ def main_app it 'create a new user with the default first name' do action - expect(User.last.first_name).to be_eql('Max') + expect(User.last.first_name).to eql('Max') end end @@ -163,7 +163,7 @@ def main_app it 'create a new user with the correct first name' do action - expect(User.last.first_name).to be_eql('Bernd') + expect(User.last.first_name).to eql('Bernd') end context 'with custom renderer' do @@ -177,7 +177,7 @@ def main_app end it 'uses the custom renderer' do - expect(response.body).to be_eql('{"test":true}') + expect(response.body).to eql('{"test":true}') end end @@ -193,7 +193,7 @@ def main_app context 'when unauthenticated' do it 'responds the 401 status code' do - expect(response.status).to be_eql(401) + expect(response).to have_http_status(:unauthorized) end end @@ -203,7 +203,7 @@ def main_app end it 'responds the 200 status code' do - expect(response.status).to be_eql(200) + expect(response).to have_http_status(:ok) end end end @@ -229,7 +229,7 @@ def main_app let(:name) { 'UX Testcase #1' } it 'returns the correct group name' do - expect(action).to be_eql('UX Scenarios') + expect(action).to eql('UX Scenarios') end end @@ -237,7 +237,7 @@ def main_app let(:name) { 'Fancy Testcase #1' } it 'returns the correct group name' do - expect(action).to be_eql('Various') + expect(action).to eql('Various') end end end diff --git a/spec/factory_bot/instrumentation/engine/with_factory_bot_rails_spec.rb b/spec/factory_bot/instrumentation/engine/with_factory_bot_rails_spec.rb index 53f1dfd..20bdc09 100644 --- a/spec/factory_bot/instrumentation/engine/with_factory_bot_rails_spec.rb +++ b/spec/factory_bot/instrumentation/engine/with_factory_bot_rails_spec.rb @@ -3,6 +3,9 @@ ENV['FACTORY_BOT_RAILS'] = 'true' require 'spec_helper' +# rubocop:disable RSpec/SpecFilePathFormat because we have to split the spec +# into multiple files to stub the availability of the +factory_bot_rails+ gem +# properly RSpec.describe FactoryBot::Instrumentation::Engine do context 'with factory_bot_rails' do it 'does not raise' do @@ -10,3 +13,4 @@ end end end +# rubocop:enable RSpec/SpecFilePathFormat diff --git a/spec/factory_bot/instrumentation/engine/without_factory_bot_rails_spec.rb b/spec/factory_bot/instrumentation/engine/without_factory_bot_rails_spec.rb index 1e22919..0c98a77 100644 --- a/spec/factory_bot/instrumentation/engine/without_factory_bot_rails_spec.rb +++ b/spec/factory_bot/instrumentation/engine/without_factory_bot_rails_spec.rb @@ -3,6 +3,9 @@ ENV['FACTORY_BOT_RAILS'] = 'false' require 'spec_helper' +# rubocop:disable RSpec/SpecFilePathFormat because we have to split the spec +# into multiple files to stub the availability of the +factory_bot_rails+ gem +# properly RSpec.describe FactoryBot::Instrumentation::Engine do context 'without factory_bot_rails' do it 'does not raise' do @@ -10,3 +13,4 @@ end end end +# rubocop:enable RSpec/SpecFilePathFormat diff --git a/spec/factory_bot_instrumentation_spec.rb b/spec/factory_bot/instrumentation_spec.rb similarity index 100% rename from spec/factory_bot_instrumentation_spec.rb rename to spec/factory_bot/instrumentation_spec.rb