diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b73e450..101416c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: - push - pull_request +permissions: + contents: read + jobs: rspec: runs-on: ubuntu-20.04 @@ -12,6 +15,9 @@ jobs: fail-fast: false matrix: ruby: + - '3.3' + - '3.2' + - '3.1' - '3.0' - '2.7' - '2.6' @@ -26,29 +32,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - - - name: Setup Ruby cache - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems-${{ matrix.ruby }}- - - - name: Bundle - run: | - gem install bundler - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + bundler-cache: true - name: RSpec & publish code coverage - uses: paambaati/codeclimate-action@v2.7.5 + uses: paambaati/codeclimate-action@v8 env: CC_TEST_REPORTER_ID: b7ba588af2a540fa96c267b3655a2afe31ea29976dc25905a668dd28d5e88915 with: diff --git a/Gemfile b/Gemfile index f1a10c3c..1ec9bada 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gemspec platforms :ruby do if RUBY_VERSION >= "2.5.0" - gem 'sqlite3' + gem 'sqlite3', '~> 1.4' else gem 'sqlite3', '~> 1.3.6' end @@ -22,8 +22,20 @@ else gem "rails", "~> 5.0" end -if RUBY_VERSION >= "2.5.0" +if RUBY_VERSION >= "2.7.0" gem "mongoid", github: "mongodb/mongoid" +elsif RUBY_VERSION >= "2.6.0" + gem "mongoid", "~> 8.1" else gem "mongoid", "~> 7.2" end + +if RUBY_VERSION >= "3.1.0" + gem "net-imap" + gem "net-pop" + gem "net-smtp" +end + +if RUBY_VERSION < "2.5.0" + gem "loofah", "< 2.21.0" # Workaround for `uninitialized constant Nokogiri::HTML4` +end diff --git a/spec/draper/decoratable_spec.rb b/spec/draper/decoratable_spec.rb index 8e673fa6..ccdfa6be 100644 --- a/spec/draper/decoratable_spec.rb +++ b/spec/draper/decoratable_spec.rb @@ -147,7 +147,7 @@ module Draper scoped = [Product.new] allow(Product).to receive(:all).and_return(scoped) - expect(Product.decorator_class).to receive(:decorate_collection).with(scoped, with: nil).and_return(:decorated_collection) + expect(Product.decorator_class).to receive(:decorate_collection).with(scoped, {with: nil}).and_return(:decorated_collection) expect(Product.decorate).to be :decorated_collection end diff --git a/spec/draper/decorator_spec.rb b/spec/draper/decorator_spec.rb index 876a3dd1..a6613fed 100644 --- a/spec/draper/decorator_spec.rb +++ b/spec/draper/decorator_spec.rb @@ -118,7 +118,7 @@ module Draper it "creates a CollectionDecorator using itself for each item" do object = [Model.new] - expect(CollectionDecorator).to receive(:new).with(object, with: Decorator) + expect(CollectionDecorator).to receive(:new).with(object, {with: Decorator}) Decorator.decorate_collection(object) end @@ -134,7 +134,7 @@ module Draper it "creates a custom collection decorator using itself for each item" do object = [Model.new] - expect(ProductsDecorator).to receive(:new).with(object, with: ProductDecorator) + expect(ProductsDecorator).to receive(:new).with(object, {with: ProductDecorator}) ProductDecorator.decorate_collection(object) end diff --git a/spec/draper/factory_spec.rb b/spec/draper/factory_spec.rb index 9a9ce24a..83b479b2 100644 --- a/spec/draper/factory_spec.rb +++ b/spec/draper/factory_spec.rb @@ -73,17 +73,17 @@ module Draper worker = ->(*){} allow(Factory::Worker).to receive_messages new: worker - expect(worker).to receive(:call).with(baz: "qux", context: {foo: "bar"}) + expect(worker).to receive(:call).with({baz: "qux", context: {foo: "bar"}}) factory.decorate(double, {baz: "qux"}) end it "is overridden by explicitly-specified context" do - factory = Factory.new(context: {foo: "bar"}) + factory = Factory.new({context: {foo: "bar"}}) worker = ->(*){} allow(Factory::Worker).to receive_messages new: worker - expect(worker).to receive(:call).with(context: {baz: "qux"}) - factory.decorate(double, context: {baz: "qux"}) + expect(worker).to receive(:call).with({context: {baz: "qux"}}) + factory.decorate(double, {context: {baz: "qux"}}) end end end @@ -109,7 +109,7 @@ module Draper allow(worker).to receive_messages decorator: decorator context = {foo: "bar"} - expect(decorator).to receive(:call).with(anything(), context: context) + expect(decorator).to receive(:call).with(anything(), {context: context}) worker.call(context: ->{ context }) end @@ -140,7 +140,7 @@ module Draper allow(worker).to receive_messages decorator: decorator context = {foo: "bar"} - expect(decorator).to receive(:call).with(anything(), context: context) + expect(decorator).to receive(:call).with(anything(), {context: context}) worker.call(context: context) end end @@ -150,7 +150,7 @@ module Draper decorator = ->(*){} allow(worker).to receive_messages decorator: decorator - expect(decorator).to receive(:call).with(anything(), foo: "bar") + expect(decorator).to receive(:call).with(anything(), {foo: "bar"}) worker.call(foo: "bar", context_args: []) end end @@ -228,7 +228,7 @@ module Draper allow(object).to receive(:decorate){ nil } worker = Factory::Worker.new(nil, object) - expect(decorator_class).to receive(:decorate_collection).with(object, foo: "bar", with: nil).and_return(:decorated) + expect(decorator_class).to receive(:decorate_collection).with(object, {foo: "bar", with: nil}).and_return(:decorated) expect(worker.decorator.call(object, foo: "bar")).to be :decorated end end