Browse Source

Follow up: Applied RuboCop Style/BlockDelimiters to improve readability.

Thorsten Eckel 7 years ago
parent
commit
4e8bc9564e

+ 6 - 6
db/migrate/20170908000001_fixed_twitter_ticket_article_preferences4.rb

@@ -7,13 +7,13 @@ class FixedTwitterTicketArticlePreferences4 < ActiveRecord::Migration[5.0]
     # find article preferences with Twitter::NullObject and replace it with nill to prevent elasticsearch index issue
     article_type_ids = Ticket::Article::Type.where(name: ['twitter status', 'twitter direct-message']).pluck(:id)
     article_ids = Ticket::Article.where(type_id: article_type_ids).pluck(:id)
-    article_ids.each { |article_id|
+    article_ids.each do |article_id|
       article = Ticket::Article.find(article_id)
       next if !article.preferences
       changed = false
-      article.preferences.each { |_key, value|
+      article.preferences.each do |_key, value|
         next if value.class != ActiveSupport::HashWithIndifferentAccess
-        value.each { |sub_key, sub_level|
+        value.each do |sub_key, sub_level|
           if sub_level.class == NilClass
             value[sub_key] = nil
             next
@@ -26,11 +26,11 @@ class FixedTwitterTicketArticlePreferences4 < ActiveRecord::Migration[5.0]
           next if sub_level.class != Twitter::NullObject
           value[sub_key] = nil
           changed = true
-        }
-      }
+        end
+      end
       next if !changed
       article.save!
-    }
+    end
 
   end
 end

+ 2 - 2
lib/tasks/search_index_es.rake

@@ -43,14 +43,14 @@ namespace :searchindex do
   task :reload, [:opts] => :environment do |_t, _args|
 
     puts 'reload data...'
-    Models.searchable.each { |model_class|
+    Models.searchable.each do |model_class|
       puts " reload #{model_class}"
       started_at = Time.zone.now
       puts "  - started at #{started_at}"
       model_class.search_index_reload
       took = Time.zone.now - started_at
       puts "  - took #{took.to_i} seconds"
-    }
+    end
 
   end
 

+ 2 - 2
lib/tasks/test_browser.rake

@@ -9,11 +9,11 @@ namespace :test do
     if !args.opts
       args.opts = ''
     end
-    Dir.glob('test/browser/*_test.rb').sort.each { |r|
+    Dir.glob('test/browser/*_test.rb').sort.each do |r|
       sh "#{args.opts} ruby -Itest #{r}" do |ok, res|
         raise 'Failed test. ' + res.inspect if !ok
       end
-    }
+    end
     puts 'All browser tests, elapsed: ' + (Time.zone.now - start).to_s + ' seconds'
 
   end

+ 2 - 2
spec/lib/ldap_spec.rb

@@ -206,13 +206,13 @@ RSpec.describe Ldap do
     # expectations and reuse it in 'let' instance
     # as return param of Net::LDAP.new
     let(:mocked_ldap) { double(bind: true) }
-    let(:instance) {
+    let(:instance) do
       expect(Net::LDAP).to receive(:new).and_return(mocked_ldap)
       described_class.new(
         host: 'localhost',
         port: 1337,
       )
-    }
+    end
 
     context '#preferences' do
 

+ 2 - 2
test/unit/ticket_article_dos_test.rb

@@ -72,7 +72,7 @@ class TicketArticleDos < ActiveSupport::TestCase
       created_by_id: 1,
     )
 
-    assert_raises(Exceptions::UnprocessableEntity) {
+    assert_raises(Exceptions::UnprocessableEntity) do
       article3 = Ticket::Article.create!(
         ticket_id: ticket3.id,
         type_id: Ticket::Article::Type.find_by(name: 'phone').id,
@@ -83,7 +83,7 @@ class TicketArticleDos < ActiveSupport::TestCase
         updated_by_id: 1,
         created_by_id: 1,
       )
-    }
+    end
 
   end