Skip to content

Commit

Permalink
Merge pull request #180 from bearded/hide_actions
Browse files Browse the repository at this point in the history
Remove ActionController::HideActions
  • Loading branch information
spastorino committed Jan 14, 2015
2 parents e826853 + 5817bd3 commit 2fe9645
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2
- ruby-head
- jruby
- rbx-2
Expand All @@ -15,10 +16,11 @@ gemfile:

matrix:
include:
- rvm: 2.1
- rvm: 2.2
gemfile: Gemfile.edge
- rvm: ruby-head
gemfile: Gemfile.edge
allow_failures:
- rvm: rbx-2
gemfile: Gemfile.edge

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## master

* Rubinius rubysl ~> 2.1 and added gem `psysch` into :rbx section of Gemfiles (@bearded)
* Require Ruby 2.2 for Rails 5.0 (@bearded)
* Removed ActionController::HideActions (@bearded)
* bcrypt-ruby was renamed to bcrypt (@djbender)
* Fixing use of deprecated `serve_static_assets` config option (@theunraveler)
* ActionDispatch::Head replaced by Rack::Head (@bearded)
* Converted Rails4 checks into Rails3 checks (@bearded)
* Green tests on Rails 5.0.0.alpha (@bearded)
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
gemspec

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc', '~> 1.4.10'
gem 'rubysl', '~> 2.1'
gem 'racc'
gem 'psych'
end
5 changes: 3 additions & 2 deletions Gemfile.edge
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem 'rails', github: 'rails/rails', branch: 'master'
gem 'arel', github: 'rails/arel', branch: 'master'

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc', '~> 1.4.10'
gem 'rubysl', '~> 2.1'
gem 'racc'
gem 'psych'
end
5 changes: 4 additions & 1 deletion lib/rails-api/action_controller/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def self.without_modules(*modules)
end

MODULES = [
HideActions,
UrlFor,
Redirecting,
Rendering,
Expand Down Expand Up @@ -151,6 +150,10 @@ def self.without_modules(*modules)
include ActionView::Rendering
end

if Rails::VERSION::MAJOR < 5
include ActionController::HideActions
end

MODULES.each do |mod|
include mod
end
Expand Down
17 changes: 13 additions & 4 deletions test/api_controller/action_methods_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
class ActionMethodsApiController < ActionController::API
def one; end
def two; end
hide_action :two
# Rails 5 does not have method hide_action
if Rails::VERSION::MAJOR < 5
hide_action :two
end
end

class ActionMethodsApiTest < ActionController::TestCase
tests ActionMethodsApiController

def test_action_methods
assert_equal Set.new(%w(one)),
@controller.class.action_methods,
"#{@controller.controller_path} should not be empty!"
if Rails::VERSION::MAJOR < 5
assert_equal Set.new(%w(one)),
@controller.class.action_methods,
"#{@controller.controller_path} should not be empty!"
else
assert_equal Set.new(%w(one two)),
@controller.class.action_methods,
"#{@controller.controller_path} should not be empty!"
end
end
end

0 comments on commit 2fe9645

Please sign in to comment.