From 892e38c78e03c11afaa5f01d995e3a21bd92b415 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 21 Dec 2018 02:44:01 +0900 Subject: Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before. --- railties/test/commands/routes_test.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'railties/test/commands/routes_test.rb') diff --git a/railties/test/commands/routes_test.rb b/railties/test/commands/routes_test.rb index 693e532c5b..9efab27b38 100644 --- a/railties/test/commands/routes_test.rb +++ b/railties/test/commands/routes_test.rb @@ -161,19 +161,18 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase end test "rails routes with expanded option" do - begin - previous_console_winsize = IO.console.winsize - IO.console.winsize = [0, 27] + previous_console_winsize = IO.console.winsize + IO.console.winsize = [0, 27] - app_file "config/routes.rb", <<-RUBY + app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do get '/cart', to: 'cart#show' end RUBY - output = run_routes_command(["--expanded"]) + output = run_routes_command(["--expanded"]) - assert_equal <<~MESSAGE, output + assert_equal <<~MESSAGE, output --[ Route 1 ]-------------- Prefix | cart Verb | GET @@ -205,9 +204,8 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase URI | /rails/active_storage/direct_uploads(.:format) Controller#Action | active_storage/direct_uploads#create MESSAGE - ensure - IO.console.winsize = previous_console_winsize - end + ensure + IO.console.winsize = previous_console_winsize end private -- cgit v1.2.3