diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0bd8739..19e5fb5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -576,9 +576,3 @@ Style/UnlessElse: Style/UnneededPercentQ: Exclude: - 'spec/models/notice_spec.rb' - -# Offense count: 10 -# Cop supports --auto-correct. -# Configuration parameters: WordRegex. -Style/WordArray: - MinSize: 11 diff --git a/app/models/notification_services/hipchat_service.rb b/app/models/notification_services/hipchat_service.rb index 8180b87..ec4bd02 100644 --- a/app/models/notification_services/hipchat_service.rb +++ b/app/models/notification_services/hipchat_service.rb @@ -20,7 +20,7 @@ if defined? HipChat }], ] Mandatory_fields = [:service, :api_token, :room_id] - API_versions = ['v1', 'v2'] + API_versions = %w(v1 v2) def check_params Fields.each do |field, hash| diff --git a/config/load.rb b/config/load.rb index c4caf88..e808b6a 100644 --- a/config/load.rb +++ b/config/load.rb @@ -26,7 +26,7 @@ Errbit::Config = Configurator.run({ serve_static_assets: ['SERVE_STATIC_ASSETS'], secret_key_base: ['SECRET_KEY_BASE'], - mongo_url: ['MONGOLAB_URI', 'MONGOHQ_URL', 'MONGODB_URL', 'MONGO_URL'], + mongo_url: %w(MONGOLAB_URI MONGOHQ_URL MONGODB_URL MONGO_URL), # github github_url: ['GITHUB_URL', ->(values) { @@ -48,8 +48,8 @@ Errbit::Config = Configurator.run({ smtp_address: ['SMTP_SERVER'], smtp_port: ['SMTP_PORT'], smtp_authentication: ['SMTP_AUTHENTICATION'], - smtp_user_name: ['SMTP_USERNAME', 'SENDGRID_USERNAME'], - smtp_password: ['SMTP_PASSWORD', 'SENDGRID_PASSWORD'], + smtp_user_name: %w(SMTP_USERNAME SENDGRID_USERNAME), + smtp_password: %w(SMTP_PASSWORD SENDGRID_PASSWORD), smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', ->(values) { values[:smtp_domain] || (values[:email_from] && values[:email_from].split('@').last)|| diff --git a/spec/controllers/api/v1/problems_controller_spec.rb b/spec/controllers/api/v1/problems_controller_spec.rb index 2152430..f996230 100644 --- a/spec/controllers/api/v1/problems_controller_spec.rb +++ b/spec/controllers/api/v1/problems_controller_spec.rb @@ -37,19 +37,18 @@ describe Api::V1::ProblemsController, type: 'controller' do get :show, :auth_token => @user.authentication_token, :format => "json", :id => @problem.id returned_problem = JSON.parse(response.body) - expect( returned_problem.keys ).to match_array([ - "app_name", - "first_notice_at", - "message", - "app_id", - "last_notice_at", - "_id", - "resolved", - "resolved_at", - "where", - "notices_count", - "environment" - ]) + expect( returned_problem.keys ).to match_array(%w( + app_name + first_notice_at + message + app_id + last_notice_at + _id + resolved + resolved_at + where + notices_count + environment)) end it "returns a 404 if the problem cannot be found" do diff --git a/spec/controllers/apps_controller_spec.rb b/spec/controllers/apps_controller_spec.rb index e364184..144b753 100644 --- a/spec/controllers/apps_controller_spec.rb +++ b/spec/controllers/apps_controller_spec.rb @@ -118,7 +118,7 @@ describe AppsController, type: 'controller' do context 'with environment filters' do before(:each) do - environments = ['production', 'test', 'development', 'staging'] + environments = %w(production test development staging) 20.times do |i| Fabricate(:problem, :app => app, :environment => environments[i % environments.length]) end diff --git a/spec/controllers/problems_controller_spec.rb b/spec/controllers/problems_controller_spec.rb index 65fd97b..abfc54b 100644 --- a/spec/controllers/problems_controller_spec.rb +++ b/spec/controllers/problems_controller_spec.rb @@ -34,7 +34,7 @@ describe ProblemsController, type: 'controller' do context 'with environment filters' do before(:each) do - environments = ['production', 'test', 'development', 'staging'] + environments = %w(production test development staging) 20.times do |i| Fabricate(:problem, :environment => environments[i % environments.length]) end diff --git a/spec/lib/configurator_spec.rb b/spec/lib/configurator_spec.rb index 6bc5500..7d834b9 100644 --- a/spec/lib/configurator_spec.rb +++ b/spec/lib/configurator_spec.rb @@ -6,12 +6,12 @@ describe Configurator do end it 'takes the first existing env, second item' do - result = Configurator.run({ two: ['VARTWO', 'VARTHREE'] }) + result = Configurator.run({ two: %w(VARTWO VARTHREE) }) expect(result.two).to eq('zipp') end it 'takes the first existing env, first item' do - result = Configurator.run({ three: ['VARTHREE', 'VARONE'] }) + result = Configurator.run({ three: %w(VARTHREE VARONE) }) expect(result.three).to eq('zipp') end @@ -44,7 +44,7 @@ describe Configurator do it 'extracts array values' do allow(ENV).to receive(:[]).with('MYARRAY').and_return('[one,two,three]') result = Configurator.run({ myarray: ['MYARRAY'] }) - expect(result.myarray).to eq(['one', 'two', 'three']) + expect(result.myarray).to eq(%w(one two three)) end it 'extracts booleans' do -- libgit2 0.21.2