Permalink
Browse files

Rename http-only app generator option to http

[Carlos Antonio da Silva & Santiago Pastorino]
  • Loading branch information...
carlosantoniodasilva authored and spastorino committed Mar 12, 2012
1 parent 2c0f6b0 commit 3e138df9776985de8ab367dcd9757b404c53435e
@@ -144,8 +144,8 @@ module Generators
class AppGenerator < AppBase
add_shared_options_for "application"
- class_option :http_only, :type => :boolean, :default => false,
- :desc => "Preconfigure smaller stack for HTTP only apps"
+ class_option :http, :type => :boolean, :default => false,
+ :desc => "Preconfigure smaller stack for HTTP only apps"
# Add bin/rails options
class_option :version, :type => :boolean, :aliases => "-v", :group => :rails,
@@ -1,5 +1,5 @@
-class ApplicationController < ActionController::<%= options.http_only? ? "HTTP" : "Base" %>
+class ApplicationController < ActionController::<%= options.http? ? "HTTP" : "Base" %>
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :reset_session instead.
- <%= comment_if :http_only %>protect_from_forgery :with => :exception
+ <%= comment_if :http %>protect_from_forgery :with => :exception
end
@@ -67,7 +67,7 @@ class Application < Rails::Application
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
<% end -%>
-<% if options.http_only? -%>
+<% if options.http? -%>
# Only loads a smaller set of middleware suitable for HTTP only apps.
# Middleware like session, flash, cookies can be added back manually.
@@ -361,19 +361,19 @@ def test_active_record_dependent_restrict_raises_is_present_application_config
assert_file "config/application.rb", /config\.active_record\.dependent_restrict_raises = false/
end
- def test_http_only_generates_config_middleware_and_generator_http_only_setup
- run_generator [destination_root, "--http-only"]
+ def test_http_generates_config_middleware_and_generator_http_setup
+ run_generator [destination_root, "--http"]
assert_file "config/application.rb", /config\.middleware\.http_only!/,
/config\.generators\.http_only!/
end
- def test_http_only_generates_application_controller_with_action_controller_http
- run_generator [destination_root, "--http-only"]
+ def test_http_generates_application_controller_with_action_controller_http
+ run_generator [destination_root, "--http"]
assert_file "app/controllers/application_controller.rb",
/class ApplicationController < ActionController::HTTP/
end
- def test_http_only_generates_application_controller_with_protect_from_forgery_commented_out_setup
+ def test_http_generates_application_controller_with_protect_from_forgery_commented_out_setup
run_generator [destination_root, "--http"]
assert_file "app/controllers/application_controller.rb", /^ # protect_from_forgery/
end

0 comments on commit 3e138df

Please sign in to comment.