Skip to content

Commit

Permalink
Merge d0791d5 into 5cb8fe3
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Jan 27, 2020
2 parents 5cb8fe3 + d0791d5 commit dfef5fb
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 29 deletions.
56 changes: 40 additions & 16 deletions .travis.yml
@@ -1,9 +1,11 @@
rvm:
- 2.1.10
- 2.2.7
- 2.3.4
- 2.4.1
- 2.5.3
- 2.2.10
- 2.3.8
- 2.4.9
- 2.5.7
- 2.6.5
- 2.7.0

gemfile:
- gemfiles/rails_3.2.gemfile
Expand All @@ -13,6 +15,7 @@ gemfile:
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
- gemfiles/rails_6.0.gemfile

matrix:
exclude:
Expand All @@ -22,32 +25,53 @@ matrix:
gemfile: gemfiles/rails_5.1.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails_5.2.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails_6.0.gemfile

- rvm: 2.2.10
gemfile: gemfiles/rails_6.0.gemfile

- rvm: 2.3.8
gemfile: gemfiles/rails_4.0.gemfile
- rvm: 2.3.8
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.3.8
gemfile: gemfiles/rails_6.0.gemfile

- rvm: 2.4.9
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.9
gemfile: gemfiles/rails_4.0.gemfile
- rvm: 2.4.9
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.4.9
gemfile: gemfiles/rails_6.0.gemfile

- rvm: 2.3.4
- rvm: 2.5.7
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.3.4
- rvm: 2.5.7
gemfile: gemfiles/rails_4.0.gemfile
- rvm: 2.3.4
- rvm: 2.5.7
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.3.4
- rvm: 2.5.7
gemfile: gemfiles/rails_4.2.gemfile

- rvm: 2.4.1
- rvm: 2.6.5
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.1
- rvm: 2.6.5
gemfile: gemfiles/rails_4.0.gemfile
- rvm: 2.4.1
- rvm: 2.6.5
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.4.1
- rvm: 2.6.5
gemfile: gemfiles/rails_4.2.gemfile

- rvm: 2.5.3
- rvm: 2.7.0
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.5.3
- rvm: 2.7.0
gemfile: gemfiles/rails_4.0.gemfile
- rvm: 2.5.3
- rvm: 2.7.0
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.5.3
- rvm: 2.7.0
gemfile: gemfiles/rails_4.2.gemfile

sudo: false
Expand Down
5 changes: 4 additions & 1 deletion Appraisals
Expand Up @@ -33,5 +33,8 @@ end

appraise 'rails-5.2' do
gem 'rails', '~> 5.2.0'
gem 'pg'
end

appraise 'rails-6.0' do
gem 'rails', '~> 6.0.0'
end
10 changes: 3 additions & 7 deletions eaco.gemspec
Expand Up @@ -17,14 +17,10 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "bundler", '>= 1.6', '< 3'
spec.add_development_dependency "rake"
spec.add_development_dependency "byebug"
# Starting from version 2.12.7, guard includes listen >= 2.7, and
# starting from version 3.1.2, listen includes ruby_dep, that
# works only from Ruby 2.2.3 onwards. However eaco supports 2.0
# and up.
spec.add_development_dependency "guard", "< 2.12.7"
spec.add_development_dependency "guard"
spec.add_development_dependency "yard"
spec.add_development_dependency "appraisal"
spec.add_development_dependency "rspec"
Expand All @@ -35,5 +31,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "coveralls"
spec.add_development_dependency "guard-shell"
spec.add_development_dependency "rails"
spec.add_development_dependency "pg", "~> 0.21"
spec.add_development_dependency "pg"
end
4 changes: 2 additions & 2 deletions features/authorization_parse_error.feature
Expand Up @@ -6,11 +6,11 @@ Feature: Authorization rules error handling
Scenario: Giving rubbish
When I have a wrong authorization definition such as
"""
if you give me rubbish please go elsewhere
1+1=2
"""
Then I should receive a DSL error SyntaxError saying
"""
\(feature\):1: syntax error.+please go elsewhere
\(feature\):1: syntax error, unexpected '=', expecting end-of-input
"""

Scenario: Referencing a non-existing model
Expand Down
2 changes: 1 addition & 1 deletion features/enterprise_authorization.feature
Expand Up @@ -199,7 +199,7 @@ Feature: Role-based, flexible authorization
Scenario: Authorizing a controller
When I have an authorized Controller defined as
"""
if ActionPack::VERSION::MAJOR == 5
if ActionPack::VERSION::MAJOR >= 5
before_action :find_document
else
before_filter :find_document
Expand Down
1 change: 0 additions & 1 deletion gemfiles/rails_5.2.gemfile
Expand Up @@ -3,6 +3,5 @@
source "https://rubygems.org"

gem "rails", "~> 5.2.0"
gem "pg"

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/rails_6.0.gemfile
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 6.0.0"

gemspec path: "../"
1 change: 1 addition & 0 deletions lib/eaco/adapters/active_record/compatibility.rb
Expand Up @@ -13,6 +13,7 @@ class Compatibility
autoload :V50, 'eaco/adapters/active_record/compatibility/v50.rb'
autoload :V51, 'eaco/adapters/active_record/compatibility/v51.rb'
autoload :V52, 'eaco/adapters/active_record/compatibility/v52.rb'
autoload :V60, 'eaco/adapters/active_record/compatibility/v60.rb'

autoload :Scoped, 'eaco/adapters/active_record/compatibility/scoped.rb'
autoload :Sanitized, 'eaco/adapters/active_record/compatibility/sanitized.rb'
Expand Down
30 changes: 30 additions & 0 deletions lib/eaco/adapters/active_record/compatibility/v60.rb
@@ -0,0 +1,30 @@
module Eaco
module Adapters
module ActiveRecord
class Compatibility

##
# Rails 6.0 support module.
#
# JSONB works correctly, but we need +.scoped+ so we revive it through
# the {Scoped} support module.
#
# @see Scoped
#
# Sanitize has dissapeared in favour of quote.
#
# @see Sanitized
#
module V60
extend ActiveSupport::Concern

included do
extend Scoped
extend Sanitized
end
end

end
end
end
end
2 changes: 1 addition & 1 deletion lib/eaco/controller.rb
Expand Up @@ -54,7 +54,7 @@ def authorize(*actions)
actions.each {|action| authorization_permissions.update(action => target)}

@_eaco_filter_installed ||= begin
if ActionPack::VERSION::MAJOR == 5
if ActionPack::VERSION::MAJOR >= 5
before_action :confront_eaco
else
before_filter :confront_eaco
Expand Down

0 comments on commit dfef5fb

Please sign in to comment.