From 081ac24295eb65573df5656879557bd51894dbec Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 19 Nov 2015 21:35:48 +0000 Subject: [PATCH] Fix rubocop warnings --- app/controllers/changeset_controller.rb | 4 ++-- app/controllers/oauth_controller.rb | 2 +- lib/classic_pagination/pagination.rb | 3 +-- lib/classic_pagination/pagination_helper.rb | 2 +- test/controllers/user_blocks_controller_test.rb | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 9ac82d092..733c20922 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -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) diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb index 8ce53739f..88691f862 100644 --- a/app/controllers/oauth_controller.rb +++ b/app/controllers/oauth_controller.rb @@ -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? diff --git a/lib/classic_pagination/pagination.rb b/lib/classic_pagination/pagination.rb index b48844000..ee0c5b7dc 100644 --- a/lib/classic_pagination/pagination.rb +++ b/lib/classic_pagination/pagination.rb @@ -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) diff --git a/lib/classic_pagination/pagination_helper.rb b/lib/classic_pagination/pagination_helper.rb index 238b8836e..ae03b82b2 100644 --- a/lib/classic_pagination/pagination_helper.rb +++ b/lib/classic_pagination/pagination_helper.rb @@ -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 diff --git a/test/controllers/user_blocks_controller_test.rb b/test/controllers/user_blocks_controller_test.rb index ebf57488c..839dadf19 100644 --- a/test/controllers/user_blocks_controller_test.rb +++ b/test/controllers/user_blocks_controller_test.rb @@ -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 -- 2.39.5