diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 3b22f35..47c4d11 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,41 +1,65 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake -# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby - name: Ruby on: - push: - branches: [ master ] pull_request: - branches: [ master ] + types: [assigned, opened, edited, synchronize, reopened] + push: + branches: + - 'master' jobs: - test: + # pre-spec + # + rubocop: + runs-on: ubuntu-latest + steps: + - name: Check out branch + uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + - run: gem install rubocop --no-doc + - name: Run rubocop + run: rubocop --format progress --format json --out rubocop.json + + test-ruby-3-rails-6: + runs-on: ubuntu-latest + needs: ['rubocop'] + strategy: + matrix: + ruby-version: ['3.0', '3.1', 'head'] + rails-version: ['~> 6.1.4'] + + steps: + - name: Check out branch + uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + env: + RAILS_VERSION: ${{ matrix.rails-version }} + - name: Run tests + run: bundle exec rake test + test-rub-27: runs-on: ubuntu-latest + needs: ['rubocop'] strategy: matrix: - ruby-version: ['2.6', '2.7'] - rails-version: ['~> 5.1.7', '~> 5.2.4', '~> 6.0.3', '~> 6.1.1'] + ruby-version: ['2.7'] + rails-version: ['~> 5.2.4', '~> 6.1.4'] steps: - - uses: actions/checkout@v2 + - name: Check out branch + uses: actions/checkout@v2 - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically + bundler-cache: true env: RAILS_VERSION: ${{ matrix.rails-version }} - name: Run tests run: bundle exec rake test - # - name: Run rubocop - # run: bundle exec rubocop - # continue-on-error: true diff --git a/.rubocop.yml b/.rubocop.yml index 9ed37c8..ec971c1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: + TargetRubyVersion: 2.7 Exclude: - 'Gemfile' - 'acts_as_follower.gemspec' diff --git a/acts_as_follower.gemspec b/acts_as_follower.gemspec index a3d7061..7ab2a82 100644 --- a/acts_as_follower.gemspec +++ b/acts_as_follower.gemspec @@ -19,12 +19,12 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'activerecord', '>= 5.0' + s.add_dependency 'activerecord', '>= 5.0', '< 7.0' s.add_development_dependency "sqlite3" s.add_development_dependency "shoulda_create" s.add_development_dependency "shoulda" s.add_development_dependency "factory_bot" - s.add_development_dependency "rails", ">= 5.0" - s.add_development_dependency "rubocop", ">= 1.0" + s.add_development_dependency "rails", ">= 5.0", '< 7.0' + s.add_development_dependency "rubocop", ">= 1.20" end diff --git a/lib/acts_as_follower/follow_scopes.rb b/lib/acts_as_follower/follow_scopes.rb index 470549b..dac469b 100644 --- a/lib/acts_as_follower/follow_scopes.rb +++ b/lib/acts_as_follower/follow_scopes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ActsAsFollower #:nodoc: +module ActsAsFollower # :nodoc: module FollowScopes # returns Follow records where follower is the record passed in. def for_follower(follower) diff --git a/lib/acts_as_follower/followable.rb b/lib/acts_as_follower/followable.rb index 90bb4ac..85e245e 100644 --- a/lib/acts_as_follower/followable.rb +++ b/lib/acts_as_follower/followable.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ActsAsFollower #:nodoc: +module ActsAsFollower # :nodoc: module Followable def self.included(base) base.extend ClassMethods diff --git a/lib/acts_as_follower/follower.rb b/lib/acts_as_follower/follower.rb index 14dfac7..d6ed648 100644 --- a/lib/acts_as_follower/follower.rb +++ b/lib/acts_as_follower/follower.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ActsAsFollower #:nodoc: +module ActsAsFollower # :nodoc: module Follower def self.included(base) base.extend ClassMethods diff --git a/test/dummy30/config/environments/development.rb b/test/dummy30/config/environments/development.rb index c2eb637..813129a 100644 --- a/test/dummy30/config/environments/development.rb +++ b/test/dummy30/config/environments/development.rb @@ -2,6 +2,7 @@ Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb + config.eager_load = false # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development diff --git a/test/dummy30/config/environments/test.rb b/test/dummy30/config/environments/test.rb index 3bc01d1..b9fd9cb 100644 --- a/test/dummy30/config/environments/test.rb +++ b/test/dummy30/config/environments/test.rb @@ -2,6 +2,7 @@ Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb + config.eager_load = false # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that