From 4c488be9433daa5f0919c7ae56051a91b1254e86 Mon Sep 17 00:00:00 2001 From: 284km Date: Tue, 5 Dec 2017 18:46:03 +0900 Subject: [PATCH] CI against Ruby 2.2.8/2.3.5/2.4.2 (#489) * CI against Ruby 2.2.8/2.3.5/2.4.2 * Remove unnecessary magic comments with ruby 2.0 or later * Change `TargetRubyVersion` to 2.0 ruby 1.9.3 has already been dropped by https://github.com/elabs/pundit/commit/0569b065d709c42dc07a3aa9072d32395a0d5087 * Change `TargetRubyVersion` to 2.1 * Drop jruby1.7 on Travis --- .rubocop.yml | 14 +++++++------- .travis.yml | 9 ++++----- pundit.gemspec | 2 -- spec/pundit_spec.rb | 10 +++++----- spec/spec_helper.rb | 2 +- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 73e92be..c5e1e28 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: DisplayCopNames: true - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.1 Exclude: - "gemfiles/**/*" - "vendor/**/*" @@ -34,7 +34,7 @@ Metrics/PerceivedComplexity: Style/StructInheritance: Enabled: false -Style/AlignParameters: +Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Style/StringLiterals: @@ -43,7 +43,7 @@ Style/StringLiterals: Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes -Style/ClosingParenthesisIndentation: +Layout/ClosingParenthesisIndentation: Enabled: false Style/OneLineConditional: @@ -58,7 +58,7 @@ Style/Not: Documentation: Enabled: false # TODO: Enable again once we have more docs -Style/CaseIndentation: +Layout/CaseIndentation: EnforcedStyle: case SupportedStyles: - case @@ -70,13 +70,13 @@ Style/PercentLiteralDelimiters: '%w': "[]" '%W': "[]" -Style/AccessModifierIndentation: +Layout/AccessModifierIndentation: EnforcedStyle: outdent Style/SignalException: Enabled: false -Style/IndentationWidth: +Layout/IndentationWidth: Enabled: false Style/TrivialAccessors: @@ -97,7 +97,7 @@ Style/SpecialGlobalVars: Style/TrivialAccessors: Enabled: false -Style/IndentHash: +Layout/IndentHash: Enabled: false Style/DoubleNegation: diff --git a/.travis.yml b/.travis.yml index aeeed81..cde3d77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,12 @@ before_install: matrix: include: - - rvm: 2.4.1 + - rvm: 2.4.2 script: bundle exec rake rubocop # ONLY lint once, first - rvm: 2.1 - - rvm: 2.2.7 - - rvm: 2.3.4 - - rvm: 2.4.1 - - rvm: jruby-1.7.26 + - rvm: 2.2.8 + - rvm: 2.3.5 + - rvm: 2.4.2 env: - JRUBY_OPTS="--debug" - rvm: jruby-9.1.8.0 diff --git a/pundit.gemspec b/pundit.gemspec index 66adb1e..9b582d7 100644 --- a/pundit.gemspec +++ b/pundit.gemspec @@ -1,5 +1,3 @@ -# -*- encoding: utf-8 -*- - lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "pundit/version" diff --git a/spec/pundit_spec.rb b/spec/pundit_spec.rb index ad63d90..081a62c 100644 --- a/spec/pundit_spec.rb +++ b/spec/pundit_spec.rb @@ -121,10 +121,10 @@ describe Pundit do end it "returns an instantiated policy given an array of symbols" do - policy = Pundit.policy(user, [:project, :criteria]) + policy = Pundit.policy(user, %i[project criteria]) expect(policy.class).to eq Project::CriteriaPolicy expect(policy.user).to eq user - expect(policy.criteria).to eq [:project, :criteria] + expect(policy.criteria).to eq %i[project criteria] end it "returns an instantiated policy given an array of a symbol and plain model instance" do @@ -156,7 +156,7 @@ describe Pundit do end it "returns correct policy class for an array of a multi-word symbols" do - policy = Pundit.policy(user, [:project_one_two_three, :criteria_four_five_six]) + policy = Pundit.policy(user, %i[project_one_two_three criteria_four_five_six]) expect(policy.class).to eq ProjectOneTwoThree::CriteriaFourFiveSixPolicy end @@ -269,10 +269,10 @@ describe Pundit do end it "returns an instantiated policy given an array of symbols" do - policy = Pundit.policy!(user, [:project, :criteria]) + policy = Pundit.policy!(user, %i[project criteria]) expect(policy.class).to eq Project::CriteriaPolicy expect(policy.user).to eq user - expect(policy.criteria).to eq [:project, :criteria] + expect(policy.criteria).to eq %i[project criteria] end it "throws an exception if the given policy can't be found" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c784c2f..b21cc2a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -46,7 +46,7 @@ class PostPolicy < Struct.new(:user, :post) def permitted_attributes if post.user == user - [:title, :votes] + %i[title votes] else [:votes] end