]> git.openstreetmap.org Git - rails.git/commitdiff
Fix rubocop warnings
authorTom Hughes <tom@compton.nu>
Thu, 19 Nov 2015 21:35:48 +0000 (21:35 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 19 Nov 2015 21:41:33 +0000 (21:41 +0000)
app/controllers/changeset_controller.rb
app/controllers/oauth_controller.rb
lib/classic_pagination/pagination.rb
lib/classic_pagination/pagination_helper.rb
test/controllers/user_blocks_controller_test.rb

index 9ac82d092878d933e8a0e5221a037a12ec27dcf1..733c20922b72c332cb59559b798a4ea911647a72 100644 (file)
@@ -162,7 +162,7 @@ class ChangesetController < ApplicationController
     # global (SVN-style) versioning were used - then that would be
     # unambiguous.
     elements.sort! do |a, b|
-      if (a.timestamp == b.timestamp)
+      if a.timestamp == b.timestamp
         a.version <=> b.version
       else
         a.timestamp <=> b.timestamp
@@ -182,7 +182,7 @@ class ChangesetController < ApplicationController
     # check these assertions.
     elements.each do |elt|
       result.root <<
-        if (elt.version == 1)
+        if elt.version == 1
           # first version, so it must be newly-created.
           created = XML::Node.new "create"
           created << elt.to_xml_node(changeset_cache, user_display_name_cache)
index 8ce53739fdff427bd656f9b9aba7b7c90aec273c..88691f8629afa6ef8dab6a035e13410ede475930 100644 (file)
@@ -59,7 +59,7 @@ class OauthController < ApplicationController
                                     "oauth_token=#{@token.token}"
                                   else
                                     @redirect_url.query +
-                                      "&oauth_token=#{@token.token}"
+                                    "&oauth_token=#{@token.token}"
                                   end
 
             unless @token.oauth10?
index b48844000135381a83960bddc68dc0d0cd905763..ee0c5b7dce015d99e43e634040be9eccb4eca064 100644 (file)
@@ -155,8 +155,7 @@ module ActionController
 
     def create_paginators_and_retrieve_collections #:nodoc:
       Pagination::OPTIONS[self.class].each do |collection_id, options|
-        next unless options[:actions].include? action_name if
-          options[:actions]
+        next if options[:actions] && !options[:actions].include?(action_name)
 
         paginator, collection =
           paginator_and_collection_for(collection_id, options)
index 238b8836e919a834bbe1daca3e2108174aacd96f..ae03b82b25ef9aa96135a8b7570d58d2e66fe1ac 100644 (file)
@@ -97,7 +97,7 @@ module ActionView
 
         current_page = paginator.current_page
         window_pages = current_page.window(options[:window_size]).pages
-        return if window_pages.length <= 1 unless link_to_current_page
+        return unless link_to_current_page || window_pages.length > 1
 
         first = paginator.first
         last = paginator.last
index ebf57488c033ae399cc039d801d317b4983ea9df..839dadf193dac0bc0fccce78eeea188d0cb3e123 100644 (file)
@@ -229,7 +229,7 @@ class UserBlocksControllerTest < ActionController::TestCase
     b = UserBlock.find(id)
     assert_in_delta Time.now, b.created_at, 1
     assert_in_delta Time.now, b.updated_at, 1
-    assert_in_delta Time.now + 12.hour, b.ends_at, 1
+    assert_in_delta Time.now + 12.hours, b.ends_at, 1
     assert_equal false, b.needs_view
     assert_equal "Vandalism", b.reason
     assert_equal "markdown", b.reason_format