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
|
inherit_from: .rubocop_todo.yml
|
||||||
AllCops:
|
AllCops:
|
||||||
DisplayCopNames: true
|
DisplayCopNames: true
|
||||||
TargetRubyVersion: 1.9
|
TargetRubyVersion: 2.1
|
||||||
Exclude:
|
Exclude:
|
||||||
- "gemfiles/**/*"
|
- "gemfiles/**/*"
|
||||||
- "vendor/**/*"
|
- "vendor/**/*"
|
||||||
|
@ -34,7 +34,7 @@ Metrics/PerceivedComplexity:
|
||||||
Style/StructInheritance:
|
Style/StructInheritance:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/AlignParameters:
|
Layout/AlignParameters:
|
||||||
EnforcedStyle: with_fixed_indentation
|
EnforcedStyle: with_fixed_indentation
|
||||||
|
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
|
@ -43,7 +43,7 @@ Style/StringLiterals:
|
||||||
Style/StringLiteralsInInterpolation:
|
Style/StringLiteralsInInterpolation:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
|
|
||||||
Style/ClosingParenthesisIndentation:
|
Layout/ClosingParenthesisIndentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/OneLineConditional:
|
Style/OneLineConditional:
|
||||||
|
@ -58,7 +58,7 @@ Style/Not:
|
||||||
Documentation:
|
Documentation:
|
||||||
Enabled: false # TODO: Enable again once we have more docs
|
Enabled: false # TODO: Enable again once we have more docs
|
||||||
|
|
||||||
Style/CaseIndentation:
|
Layout/CaseIndentation:
|
||||||
EnforcedStyle: case
|
EnforcedStyle: case
|
||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- case
|
- case
|
||||||
|
@ -70,13 +70,13 @@ Style/PercentLiteralDelimiters:
|
||||||
'%w': "[]"
|
'%w': "[]"
|
||||||
'%W': "[]"
|
'%W': "[]"
|
||||||
|
|
||||||
Style/AccessModifierIndentation:
|
Layout/AccessModifierIndentation:
|
||||||
EnforcedStyle: outdent
|
EnforcedStyle: outdent
|
||||||
|
|
||||||
Style/SignalException:
|
Style/SignalException:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/IndentationWidth:
|
Layout/IndentationWidth:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/TrivialAccessors:
|
Style/TrivialAccessors:
|
||||||
|
@ -97,7 +97,7 @@ Style/SpecialGlobalVars:
|
||||||
Style/TrivialAccessors:
|
Style/TrivialAccessors:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/IndentHash:
|
Layout/IndentHash:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/DoubleNegation:
|
Style/DoubleNegation:
|
||||||
|
|
|
@ -6,13 +6,12 @@ before_install:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- rvm: 2.4.1
|
- rvm: 2.4.2
|
||||||
script: bundle exec rake rubocop # ONLY lint once, first
|
script: bundle exec rake rubocop # ONLY lint once, first
|
||||||
- rvm: 2.1
|
- rvm: 2.1
|
||||||
- rvm: 2.2.7
|
- rvm: 2.2.8
|
||||||
- rvm: 2.3.4
|
- rvm: 2.3.5
|
||||||
- rvm: 2.4.1
|
- rvm: 2.4.2
|
||||||
- rvm: jruby-1.7.26
|
|
||||||
env:
|
env:
|
||||||
- JRUBY_OPTS="--debug"
|
- JRUBY_OPTS="--debug"
|
||||||
- rvm: jruby-9.1.8.0
|
- rvm: jruby-9.1.8.0
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
|
|
||||||
lib = File.expand_path("../lib", __FILE__)
|
lib = File.expand_path("../lib", __FILE__)
|
||||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||||
require "pundit/version"
|
require "pundit/version"
|
||||||
|
|
|
@ -121,10 +121,10 @@ describe Pundit do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an instantiated policy given an array of symbols" do
|
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.class).to eq Project::CriteriaPolicy
|
||||||
expect(policy.user).to eq user
|
expect(policy.user).to eq user
|
||||||
expect(policy.criteria).to eq [:project, :criteria]
|
expect(policy.criteria).to eq %i[project criteria]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an instantiated policy given an array of a symbol and plain model instance" do
|
it "returns an instantiated policy given an array of a symbol and plain model instance" do
|
||||||
|
@ -156,7 +156,7 @@ describe Pundit do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns correct policy class for an array of a multi-word symbols" do
|
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
|
expect(policy.class).to eq ProjectOneTwoThree::CriteriaFourFiveSixPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -269,10 +269,10 @@ describe Pundit do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an instantiated policy given an array of symbols" do
|
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.class).to eq Project::CriteriaPolicy
|
||||||
expect(policy.user).to eq user
|
expect(policy.user).to eq user
|
||||||
expect(policy.criteria).to eq [:project, :criteria]
|
expect(policy.criteria).to eq %i[project criteria]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "throws an exception if the given policy can't be found" do
|
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
|
def permitted_attributes
|
||||||
if post.user == user
|
if post.user == user
|
||||||
[:title, :votes]
|
%i[title votes]
|
||||||
else
|
else
|
||||||
[:votes]
|
[:votes]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue