Skip to content

Commit

Permalink
Merge pull request #21 from appfolio/SupportRails6
Browse files Browse the repository at this point in the history
Support Rails 6
  • Loading branch information
wpliao1989 authored Jan 6, 2020
2 parents 79c6605 + 9a2ecb0 commit d4f31da
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
steps:
- bundle_install_and_test

test-ruby-262:
test-ruby-263:
docker:
- image: circleci/ruby:2.6.2
- image: circleci/ruby:2.6.3
steps:
- bundle_install_and_test

Expand All @@ -33,5 +33,5 @@ workflows:
context: appfolio_test_context
- test-ruby-253:
context: appfolio_test_context
- test-ruby-262:
- test-ruby-263:
context: appfolio_test_context
11 changes: 10 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
case RUBY_VERSION

when '2.3.3', '2.5.3', '2.6.2' then
when '2.3.3', '2.5.3', '2.6.3' then

appraise "ruby-#{RUBY_VERSION}-rails507" do
gem 'rails', '5.0.7'
Expand All @@ -26,6 +26,15 @@ when '2.3.3', '2.5.3', '2.6.2' then
gem 'rails-controller-testing'
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
appraise "ruby-#{RUBY_VERSION}-rails6" do
gem 'rails', '~> 6.0'
gem 'grape', '1.2.3'
gem 'rails-controller-testing'
gem 'sqlite3', '~> 1.4'
end
end

else
raise "Unsupported Ruby version #{RUBY_VERSION}"

Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ gemspec

gem 'appraisal', '~> 2.1'
gem 'mocha', '~> 1.0', require: false
gem 'sprockets', '< 4'
gem 'sqlite3', '~> 1.3.0'
2 changes: 1 addition & 1 deletion declarative_authorization.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

s.add_dependency(%q<blockenspiel>, ['~> 0.5.0'])
s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 6'])
s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 7'])
end
1 change: 1 addition & 0 deletions gemfiles/ruby_2.3.3_rails507.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.0.7"
gem "grape", "1.1.0"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.3.3_rails516.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.1.6"
gem "grape", "1.2.3"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.3.3_rails521.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.1"
gem "grape", "1.2.3"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.3.3_rails522.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.2"
gem "grape", "1.2.3"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.5.3_rails507.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.0.7"
gem "grape", "1.1.0"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.5.3_rails516.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.1.6"
gem "grape", "1.2.3"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.5.3_rails521.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.1"
gem "grape", "1.2.3"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/ruby_2.5.3_rails522.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.2"
gem "grape", "1.2.3"
Expand Down
13 changes: 13 additions & 0 deletions gemfiles/ruby_2.5.3_rails6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.4"
gem "rails", "~> 6.0"
gem "grape", "1.2.3"
gem "rails-controller-testing"

gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.0.7"
gem "grape", "1.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.1.6"
gem "grape", "1.2.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.1"
gem "grape", "1.2.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.3.0"
gem "rails", "5.2.2"
gem "grape", "1.2.3"
Expand Down
13 changes: 13 additions & 0 deletions gemfiles/ruby_2.6.3_rails6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "appraisal", "~> 2.1"
gem "mocha", "~> 1.0", require: false
gem "sprockets", "< 4"
gem "sqlite3", "~> 1.4"
gem "rails", "~> 6.0"
gem "grape", "1.2.3"
gem "rails-controller-testing"

gemspec path: "../"
14 changes: 7 additions & 7 deletions test/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ def test_model_security_write_allowed
Authorization.stub :current_user, MockUser.new(:test_role) do
assert(object = TestModelSecurityModel.create)

assert_nothing_raised { object.update_attributes(:attr_2 => 2) }
assert_nothing_raised { object.update(:attr_2 => 2) }
object.reload
assert_equal 2, object.attr_2
object.destroy
Expand Down Expand Up @@ -1441,7 +1441,7 @@ def test_model_security_write_not_allowed_no_privilege

Authorization.current_user = MockUser.new(:test_role_restricted)
assert_raise Authorization::NotAuthorized do
object.update_attributes(:attr_2 => 2)
object.update(:attr_2 => 2)
end
end

Expand Down Expand Up @@ -1471,15 +1471,15 @@ def test_model_security_write_not_allowed_wrong_attribute_value
end
object = TestModelSecurityModel.create
assert_raise Authorization::AttributeAuthorizationError do
object.update_attributes(:attr => 2)
object.update(:attr => 2)
end
object.reload

assert_nothing_raised do
object.update_attributes(:attr_2 => 1)
object.update(:attr_2 => 1)
end
assert_raise Authorization::AttributeAuthorizationError do
object.update_attributes(:attr => 2)
object.update(:attr => 2)
end
end
end
Expand Down Expand Up @@ -1625,7 +1625,7 @@ def test_model_security_with_assoc
Authorization.stub :current_user, test_attr do
assert(object = TestModelSecurityModel.create(:test_attrs => [test_attr]))
assert_nothing_raised do
object.update_attributes(:attr_2 => 2)
object.update(:attr_2 => 2)
end
without_access_control do
object.reload
Expand Down Expand Up @@ -1662,7 +1662,7 @@ def test_model_security_with_update_attrbributes

with_user MockUser.new(:test_role, :branch => test_attr.branch) do
assert_nothing_raised do
test_model.update_attributes(params[:model_data])
test_model.update(params[:model_data])
end
end
without_access_control do
Expand Down

0 comments on commit d4f31da

Please sign in to comment.