aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-12-28 21:53:51 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-12-28 21:53:51 -0500
commit010e246756c09f44e901f4fd8e8eab2cb3022e95 (patch)
treede880274810f885232ac51bbf529bab0366eca45 /actionview
parent09cdf425d70cfec541e0008c28055155d70c6f37 (diff)
downloadrails-010e246756c09f44e901f4fd8e8eab2cb3022e95.tar.gz
rails-010e246756c09f44e901f4fd8e8eab2cb3022e95.tar.bz2
rails-010e246756c09f44e901f4fd8e8eab2cb3022e95.zip
Fix Rubocop violations and fix documentation visibility
Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/Rakefile2
-rw-r--r--actionview/lib/action_view/routing_url_for.rb14
-rw-r--r--actionview/test/template/form_helper/form_with_test.rb3
-rw-r--r--actionview/test/template/form_helper_test.rb6
-rw-r--r--actionview/test/template/form_tag_helper_test.rb10
-rw-r--r--actionview/test/ujs/config.ru4
-rw-r--r--actionview/test/ujs/server.rb26
7 files changed, 32 insertions, 33 deletions
diff --git a/actionview/Rakefile b/actionview/Rakefile
index 48f17062ce..cba4684076 100644
--- a/actionview/Rakefile
+++ b/actionview/Rakefile
@@ -49,7 +49,7 @@ end
namespace :ujs do
desc "Starts the test server"
task :server do
- system 'bundle exec rackup test/ujs/config.ru -p 4567 -s puma'
+ system "bundle exec rackup test/ujs/config.ru -p 4567 -s puma"
end
end
diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb
index f6bd290bf4..687ba7c1b4 100644
--- a/actionview/lib/action_view/routing_url_for.rb
+++ b/actionview/lib/action_view/routing_url_for.rb
@@ -123,14 +123,14 @@ module ActionView
end
private
- def _routes_context
- controller
- end
+ def _routes_context
+ controller
+ end
- def optimize_routes_generation?
- controller.respond_to?(:optimize_routes_generation?, true) ?
- controller.optimize_routes_generation? : super
- end
+ def optimize_routes_generation?
+ controller.respond_to?(:optimize_routes_generation?, true) ?
+ controller.optimize_routes_generation? : super
+ end
def _generate_paths_by_default
true
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
index 08c685b00f..3a91c7dce7 100644
--- a/actionview/test/template/form_helper/form_with_test.rb
+++ b/actionview/test/template/form_helper/form_with_test.rb
@@ -339,7 +339,7 @@ class FormWithActsLikeFormForTest < FormWithTest
def test_form_with_only_url_on_update
form_with(url: "/posts/123") do |f|
- concat f.label :title, 'Label me'
+ concat f.label :title, "Label me"
concat f.text_field :title
end
@@ -965,7 +965,6 @@ class FormWithActsLikeFormForTest < FormWithTest
assert_dom_equal expected, output_buffer
end
-
def test_nested_fields
@comment.body = "Hello World"
form_with(model: @post) do |f|
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
index 4850bc390b..a345adfe6c 100644
--- a/actionview/test/template/form_helper_test.rb
+++ b/actionview/test/template/form_helper_test.rb
@@ -1829,9 +1829,9 @@ class FormHelperTest < ActionView::TestCase
obj = Class.new do
private
- def private_property
- raise "This method should not be called."
- end
+ def private_property
+ raise "This method should not be called."
+ end
end.new
form_for(obj, as: "other_name", url: "/", html: { id: "edit-other-name" }) do |f|
diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb
index 088f5ae122..1248a0bb09 100644
--- a/actionview/test/template/form_tag_helper_test.rb
+++ b/actionview/test/template/form_tag_helper_test.rb
@@ -694,31 +694,31 @@ class FormTagHelperTest < ActionView::TestCase
def test_text_area_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
text_area_tag "body", "hello world", options
- assert_equal({option: "random_option"}, options)
+ assert_equal({ option: "random_option" }, options)
end
def test_submit_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
submit_tag "submit value", options
- assert_equal({option: "random_option"}, options)
+ assert_equal({ option: "random_option" }, options)
end
def test_button_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
button_tag "button value", options
- assert_equal({option: "random_option"}, options)
+ assert_equal({ option: "random_option" }, options)
end
def test_image_submit_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
image_submit_tag "submit source", options
- assert_equal({option: "random_option"}, options)
+ assert_equal({ option: "random_option" }, options)
end
def test_image_label_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
label_tag "submit source", "title", options
- assert_equal({option: "random_option"}, options)
+ assert_equal({ option: "random_option" }, options)
end
def protect_against_forgery?
diff --git a/actionview/test/ujs/config.ru b/actionview/test/ujs/config.ru
index cb961dc140..414c2063c3 100644
--- a/actionview/test/ujs/config.ru
+++ b/actionview/test/ujs/config.ru
@@ -1,3 +1,3 @@
-$LOAD_PATH.unshift File.expand_path('..', __FILE__)
-require 'server'
+$LOAD_PATH.unshift File.expand_path("..", __FILE__)
+require "server"
run UJS::Server
diff --git a/actionview/test/ujs/server.rb b/actionview/test/ujs/server.rb
index cc02cd8419..25f70baf5f 100644
--- a/actionview/test/ujs/server.rb
+++ b/actionview/test/ujs/server.rb
@@ -12,7 +12,7 @@ module UJS
get "/rails-ujs.js" => Blade::Assets.environment
get "/" => "tests#index"
match "/echo" => "tests#echo", via: :all
- get "/error" => proc {|env| [403, {}, []] }
+ get "/error" => proc { |env| [403, {}, []] }
end
config.cache_classes = false
@@ -26,7 +26,7 @@ module UJS
end
module TestsHelper
- def jquery_link version
+ def jquery_link(version)
if params[:version] == version
"[#{version}]"
else
@@ -34,7 +34,7 @@ module TestsHelper
end
end
- def cdn_link cdn
+ def cdn_link(cdn)
if params[:cdn] == cdn
"[#{cdn}]"
else
@@ -43,22 +43,22 @@ module TestsHelper
end
def jquery_src
- if params[:version] == 'edge'
+ if params[:version] == "edge"
"/vendor/jquery.js"
- elsif params[:cdn] && params[:cdn] == 'googleapis'
+ elsif params[:cdn] && params[:cdn] == "googleapis"
"https://ajax.googleapis.com/ajax/libs/jquery/#{params[:version]}/jquery.min.js"
else
"http://code.jquery.com/jquery-#{params[:version]}.js"
end
end
- def test_to *names
+ def test_to(*names)
names = ["/vendor/qunit.js", "settings"] + names
names.map { |name| script_tag name }.join("\n").html_safe
end
- def script_tag src
- src = "/test/#{src}.js" unless src.index('/')
+ def script_tag(src)
+ src = "/test/#{src}.js" unless src.index("/")
%(<script src="#{src}" type="text/javascript"></script>).html_safe
end
@@ -72,20 +72,20 @@ class TestsController < ActionController::Base
layout "application"
def index
- params[:version] ||= ENV['JQUERY_VERSION'] || '1.11.0'
- params[:cdn] ||= 'jquery'
+ params[:version] ||= ENV["JQUERY_VERSION"] || "1.11.0"
+ params[:cdn] ||= "jquery"
render :index
end
def echo
- data = { :params => params.to_unsafe_h }.update(request.env)
+ data = { params: params.to_unsafe_h }.update(request.env)
- if params[:content_type] and params[:content]
+ if params[:content_type] && params[:content]
render inline: params[:content], content_type: params[:content_type]
elsif request.xhr?
render json: JSON.generate(data)
elsif params[:iframe]
- payload = JSON.generate(data).gsub('<', '&lt;').gsub('>', '&gt;')
+ payload = JSON.generate(data).gsub("<", "&lt;").gsub(">", "&gt;")
html = <<-HTML
<script>
if (window.top && window.top !== window)