mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
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 0569b065d7
* Change `TargetRubyVersion` to 2.1
* Drop jruby1.7 on Travis
This commit is contained in:
parent
ac2a25d93c
commit
4c488be943
5 changed files with 17 additions and 20 deletions
14
.rubocop.yml
14
.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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue