aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-09-01 23:41:49 +0200
committerXavier Noria <fxn@hashref.com>2016-09-01 23:41:49 +0200
commitbb1ecdcc677bf6e68e0252505509c089619b5b90 (patch)
tree99dd8fd164e1c582216a4b08c3d066049217bb7f /actionpack
parent8c402ef425771c3dbb4659dd946714e69fdf5ce9 (diff)
downloadrails-bb1ecdcc677bf6e68e0252505509c089619b5b90.tar.gz
rails-bb1ecdcc677bf6e68e0252505509c089619b5b90.tar.bz2
rails-bb1ecdcc677bf6e68e0252505509c089619b5b90.zip
fixes remaining RuboCop issues [Vipul A M, Xavier Noria]
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/Rakefile2
-rw-r--r--actionpack/lib/action_controller/metal/data_streaming.rb2
-rw-r--r--actionpack/lib/action_controller/metal/implicit_render.rb2
-rw-r--r--actionpack/lib/action_controller/metal/redirecting.rb2
-rw-r--r--actionpack/lib/action_dispatch/middleware/session/cache_store.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb4
-rw-r--r--actionpack/test/controller/render_test.rb2
-rw-r--r--actionpack/test/controller/routing_test.rb4
-rw-r--r--actionpack/test/dispatch/routing_test.rb8
10 files changed, 15 insertions, 15 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index 4bbbcfe9ff..31dd1865f9 100644
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -21,7 +21,7 @@ namespace :test do
task :isolated do
test_files.all? do |file|
sh(Gem.ruby, "-w", "-Ilib:test", file)
- end or raise "Failures"
+ end || raise("Failures")
end
end
diff --git a/actionpack/lib/action_controller/metal/data_streaming.rb b/actionpack/lib/action_controller/metal/data_streaming.rb
index 6a1acb64f7..f089c8423b 100644
--- a/actionpack/lib/action_controller/metal/data_streaming.rb
+++ b/actionpack/lib/action_controller/metal/data_streaming.rb
@@ -64,7 +64,7 @@ module ActionController #:nodoc:
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
# for the Cache-Control header spec.
def send_file(path, options = {}) #:doc:
- raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
+ raise MissingFile, "Cannot read file #{path}" unless File.file?(path) && File.readable?(path)
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
send_file_headers! options
diff --git a/actionpack/lib/action_controller/metal/implicit_render.rb b/actionpack/lib/action_controller/metal/implicit_render.rb
index 4137db99ea..e7e32e5108 100644
--- a/actionpack/lib/action_controller/metal/implicit_render.rb
+++ b/actionpack/lib/action_controller/metal/implicit_render.rb
@@ -61,7 +61,7 @@ module ActionController
def method_for_action(action_name)
super || if template_exists?(action_name.to_s, _prefixes)
- "default_render"
+ "default_render"
end
end
diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb
index 3c7cc15627..2bd4296aff 100644
--- a/actionpack/lib/action_controller/metal/redirecting.rb
+++ b/actionpack/lib/action_controller/metal/redirecting.rb
@@ -111,7 +111,7 @@ module ActionController
`fallback_location` represents the location to use if the request has
no HTTP referer information.
MESSAGE
- request.headers["Referer"] or raise RedirectBackError
+ request.headers["Referer"] || raise(RedirectBackError)
when Proc
_compute_redirect_to_location request, options.call
else
diff --git a/actionpack/lib/action_dispatch/middleware/session/cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/cache_store.rb
index d99c2fd411..71274bc13a 100644
--- a/actionpack/lib/action_dispatch/middleware/session/cache_store.rb
+++ b/actionpack/lib/action_dispatch/middleware/session/cache_store.rb
@@ -19,7 +19,7 @@ module ActionDispatch
# Get a session from the cache.
def find_session(env, sid)
- unless sid and session = @cache.read(cache_key(sid))
+ unless sid && (session = @cache.read(cache_key(sid)))
sid, session = generate_sid, {}
end
[sid, session]
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 67b9463a6a..4ec1b8ee1f 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1607,7 +1607,7 @@ module ActionDispatch
def root(path, options = {})
if path.is_a?(String)
options[:to] = path
- elsif path.is_a?(Hash) and options.empty?
+ elsif path.is_a?(Hash) && options.empty?
options = path
else
raise ArgumentError, "must be called with a path and/or options"
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 112a38b868..864ffe3a79 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -596,8 +596,8 @@ module ActionDispatch
# :controller, :action or :id is not found, don't pull any
# more keys from the recall.
def normalize_controller_action_id!
- use_recall_for(:controller) or return
- use_recall_for(:action) or return
+ use_recall_for(:controller) || return
+ use_recall_for(:action) || return
use_recall_for(:id)
end
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index bf83131189..399c7489b7 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -226,7 +226,7 @@ class TestController < ActionController::Base
end
def head_and_return
- head :ok and return
+ head(:ok) && return
raise "should not reach this line"
end
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index d1cc0f7d68..7be2ad2b28 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -211,7 +211,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
def test_class_and_lambda_constraints
subdomain = Class.new {
def matches?(request)
- request.subdomain.present? and request.subdomain != "clients"
+ request.subdomain.present? && request.subdomain != "clients"
end
}
@@ -229,7 +229,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
def test_lambda_constraints
rs.draw do
get "/", constraints: lambda { |req|
- req.subdomain.present? and req.subdomain != "clients" },
+ req.subdomain.present? && req.subdomain != "clients" },
to: lambda { |env| [200, {}, %w{default}] }
get "/", constraints: lambda { |req|
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 0938460632..eec34dba66 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -3672,12 +3672,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
def test_multiple_roots
draw do
namespace :foo do
- root "pages#index", constraints: { host: 'www.example.com' }
- root "admin/pages#index", constraints: { host: 'admin.example.com' }
+ root "pages#index", constraints: { host: "www.example.com" }
+ root "admin/pages#index", constraints: { host: "admin.example.com" }
end
- root "pages#index", constraints: { host: 'www.example.com' }
- root "admin/pages#index", constraints: { host: 'admin.example.com' }
+ root "pages#index", constraints: { host: "www.example.com" }
+ root "admin/pages#index", constraints: { host: "admin.example.com" }
end
get "http://www.example.com/foo"