From abfb95dae035bdb19fdfea94a663833bb6aae744 Mon Sep 17 00:00:00 2001 From: Laust Rud Jacobsen Date: Wed, 4 Nov 2015 22:04:06 +0100 Subject: [PATCH] Rubocop: spaces around and within block braces --- .rubocop_todo.yml | 12 ------------ app/controllers/apps_controller.rb | 8 ++++---- app/controllers/problems_searcher.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 4 ++-- app/helpers/apps_helper.rb | 4 ++-- app/helpers/navigation_helper.rb | 2 +- app/interactors/problem_destroy.rb | 2 +- app/models/app.rb | 2 +- app/models/deploy.rb | 2 +- app/models/notice.rb | 4 ++-- app/models/notification_services/campfire_service.rb | 2 +- app/models/notification_services/hoiio_service.rb | 2 +- app/models/notification_services/hubot_service.rb | 2 +- app/models/notification_services/pushover_service.rb | 2 +- app/models/notification_services/slack_service.rb | 2 +- app/models/notification_services/webhook_service.rb | 2 +- app/models/problem.rb | 8 ++++---- lib/hoptoad/v2.rb | 6 +++--- spec/controllers/apps_controller_spec.rb | 2 +- spec/controllers/comments_controller_spec.rb | 2 +- spec/controllers/problems_controller_spec.rb | 4 ++-- spec/controllers/watchers_controller_spec.rb | 2 +- spec/fabricators/app_fabricator.rb | 4 ++-- spec/fabricators/notice_fabricator.rb | 6 +++--- spec/fabricators/notification_service_fabricator.rb | 2 +- spec/fabricators/sequences_fabricator.rb | 4 ++-- spec/fabricators/user_fabricator.rb | 2 +- spec/interactors/problem_merge_spec.rb | 2 +- spec/interactors/user_destroy_spec.rb | 2 +- spec/mailers/mailer_spec.rb | 4 ++-- spec/models/deploy_spec.rb | 12 ++++++------ spec/models/error_report_spec.rb | 8 ++++---- spec/models/notice_observer_spec.rb | 4 ++-- spec/models/problem_spec.rb | 10 +++++----- spec/spec_helper.rb | 2 +- spec/views/problems/show.html.haml_spec.rb | 4 ++-- 37 files changed, 67 insertions(+), 79 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 451ab40..842b0f1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -270,18 +270,6 @@ Style/SingleSpaceBeforeFirstArg: - 'spec/fabricators/notice_fabricator.rb' - 'spec/fabricators/user_fabricator.rb' -# Offense count: 27 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -Style/SpaceBeforeBlockBraces: - Enabled: false - -# Offense count: 75 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. -Style/SpaceInsideBlockBraces: - Enabled: false - # Offense count: 873 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index 37cb3ca..2457e54 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -39,7 +39,7 @@ class AppsController < ApplicationController } expose(:users) { - User.all.sort_by {|u| u.name.downcase } + User.all.sort_by { |u| u.name.downcase } } def index; end @@ -96,7 +96,7 @@ protected # set the app's notification service if params[:app][:notification_service_attributes] && (notification_type = params[:app][:notification_service_attributes][:type]) available_notification_classes = [NotificationService] + NotificationService.subclasses - notification_class = available_notification_classes.detect{|c| c.name == notification_type} + notification_class = available_notification_classes.detect { |c| c.name == notification_type } if notification_class.present? app.notification_service = notification_class.new(params[:app][:notification_service_attributes]) end @@ -116,7 +116,7 @@ protected # Sanitize negative values, split on comma, # strip, parse as integer, remove all '0's. # If empty, set as default and show an error message. - email_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i }.reject{|v| v == 0} + email_at_notices = val.gsub(/-\d+/, "").split(",").map { |v| v.strip.to_i }.reject { |v| v == 0 } if email_at_notices.any? params[:app][:email_at_notices] = email_at_notices else @@ -131,7 +131,7 @@ protected # Sanitize negative values, split on comma, # strip, parse as integer, remove all '0's. # If empty, set as default and show an error message. - notify_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i } + notify_at_notices = val.gsub(/-\d+/, "").split(",").map { |v| v.strip.to_i } if notify_at_notices.any? params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices else diff --git a/app/controllers/problems_searcher.rb b/app/controllers/problems_searcher.rb index e84732d..0854f5c 100644 --- a/app/controllers/problems_searcher.rb +++ b/app/controllers/problems_searcher.rb @@ -13,7 +13,7 @@ module ProblemsSearcher end } - expose(:params_order){ + expose(:params_order) { unless %w{asc desc}.member?(params[:order]) 'desc' else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2ae0a6d..0fe7805 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,7 +65,7 @@ protected def user_permit_params @user_permit_params ||= [:name, :username, :email, :github_login, :per_page, :time_zone] @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] - @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all?{|pa| !pa.blank? } + @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all? { |pa| !pa.blank? } @user_permit_params end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 133a8f3..1925fc5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -56,8 +56,8 @@ module ApplicationHelper def create_percentage_table_from_tallies(tallies, options = {}) total = (options[:total] || total_from_tallies(tallies)) percent = 100.0 / total.to_f - rows = tallies.map {|value, count| [(count.to_f * percent), value]}. \ - sort {|a, b| b[0] <=> a[0]} + rows = tallies.map { |value, count| [(count.to_f * percent), value] }. \ + sort { |a, b| b[0] <=> a[0] } render "problems/tally_table", :rows => rows end diff --git a/app/helpers/apps_helper.rb b/app/helpers/apps_helper.rb index fe89c3b..de3ed43 100644 --- a/app/helpers/apps_helper.rb +++ b/app/helpers/apps_helper.rb @@ -4,8 +4,8 @@ module AppsHelper html = link_to('copy settings from another app', '#', :class => 'button copy_config') html << select("duplicate", "app", - App.all.asc(:name).reject{|a| a == @app }. - collect{|p| [p.name, p.id] }, { :include_blank => "[choose app]" }, + App.all.asc(:name).reject { |a| a == @app }. + collect { |p| [p.name, p.id] }, { :include_blank => "[choose app]" }, { :class => "choose_other_app", :style => "display: none;" }) return html end diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb index ad1c070..7a8aa31 100644 --- a/app/helpers/navigation_helper.rb +++ b/app/helpers/navigation_helper.rb @@ -19,7 +19,7 @@ module NavigationHelper matches when Array s = {} - matches.each {|c| s[c] = :all} + matches.each { |c| s[c] = :all } s else { matches => :all } diff --git a/app/interactors/problem_destroy.rb b/app/interactors/problem_destroy.rb index 017bde4..f8d89e4 100644 --- a/app/interactors/problem_destroy.rb +++ b/app/interactors/problem_destroy.rb @@ -20,7 +20,7 @@ class ProblemDestroy # the number of problem destroy # def self.execute(problems) - Array(problems).each{ |problem| + Array(problems).each { |problem| ProblemDestroy.new(problem).execute }.count end diff --git a/app/models/app.rb b/app/models/app.rb index 2c62359..b66a771 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -21,7 +21,7 @@ class App field :_id, type: String, pre_processed: true, - default: ->{ BSON::ObjectId.new.to_s } + default: -> { BSON::ObjectId.new.to_s } embeds_many :watchers embeds_many :deploys diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 5e09b60..ad7581d 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -19,7 +19,7 @@ class Deploy validates_presence_of :username, :environment def resolve_app_errs - app.problems.unresolved.in_env(environment).each {|problem| problem.resolve!} + app.problems.unresolved.in_env(environment).each { |problem| problem.resolve! } end def short_revision diff --git a/app/models/notice.rb b/app/models/notice.rb index b122ff8..ce4ff2c 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -26,8 +26,8 @@ class Notice validates_presence_of :backtrace_id, :server_environment, :notifier - scope :ordered, ->{ order_by(:created_at.asc) } - scope :reverse_ordered, ->{ order_by(:created_at.desc) } + scope :ordered, -> { order_by(:created_at.asc) } + scope :reverse_ordered, -> { order_by(:created_at.desc) } scope :for_errs, Proc.new { |errs| where(:err_id.in => errs.all.map(&:id)) } diff --git a/app/models/notification_services/campfire_service.rb b/app/models/notification_services/campfire_service.rb index f6a2922..7bdc078 100644 --- a/app/models/notification_services/campfire_service.rb +++ b/app/models/notification_services/campfire_service.rb @@ -17,7 +17,7 @@ if defined? Campy ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, 'You must specify your Campfire Subdomain, API token and Room ID' end end diff --git a/app/models/notification_services/hoiio_service.rb b/app/models/notification_services/hoiio_service.rb index 72b614d..4cd369b 100644 --- a/app/models/notification_services/hoiio_service.rb +++ b/app/models/notification_services/hoiio_service.rb @@ -16,7 +16,7 @@ class NotificationServices::HoiioService < NotificationService ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, 'You must specify your App ID, Access Token and Recipient\'s phone numbers' end end diff --git a/app/models/notification_services/hubot_service.rb b/app/models/notification_services/hubot_service.rb index cabcbae..a6c0336 100644 --- a/app/models/notification_services/hubot_service.rb +++ b/app/models/notification_services/hubot_service.rb @@ -12,7 +12,7 @@ class NotificationServices::HubotService < NotificationService ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, 'You must specify the URL of your hubot' end end diff --git a/app/models/notification_services/pushover_service.rb b/app/models/notification_services/pushover_service.rb index b0a7d8b..52ca738 100644 --- a/app/models/notification_services/pushover_service.rb +++ b/app/models/notification_services/pushover_service.rb @@ -12,7 +12,7 @@ class NotificationServices::PushoverService < NotificationService ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, 'You must specify your User Key and Application API Token.' end end diff --git a/app/models/notification_services/slack_service.rb b/app/models/notification_services/slack_service.rb index 95a33f4..571f278 100644 --- a/app/models/notification_services/slack_service.rb +++ b/app/models/notification_services/slack_service.rb @@ -8,7 +8,7 @@ class NotificationServices::SlackService < NotificationService ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, "You must specify your Slack Hook url." end end diff --git a/app/models/notification_services/webhook_service.rb b/app/models/notification_services/webhook_service.rb index bf759ae..f28ce08 100644 --- a/app/models/notification_services/webhook_service.rb +++ b/app/models/notification_services/webhook_service.rb @@ -8,7 +8,7 @@ class NotificationServices::WebhookService < NotificationService ] def check_params - if FIELDS.detect {|f| self[f[0]].blank? } + if FIELDS.detect { |f| self[f[0]].blank? } errors.add :base, 'You must specify the URL' end end diff --git a/app/models/problem.rb b/app/models/problem.rb index 9022f0b..325cff2 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -58,10 +58,10 @@ class Problem before_create :cache_app_attributes before_save :truncate_message - scope :resolved, ->{ where(:resolved => true) } - scope :unresolved, ->{ where(:resolved => false) } - scope :ordered, ->{ order_by(:last_notice_at.desc) } - scope :for_apps, lambda {|apps| where(:app_id.in => apps.all.map(&:id))} + scope :resolved, -> { where(:resolved => true) } + scope :unresolved, -> { where(:resolved => false) } + scope :ordered, -> { order_by(:last_notice_at.desc) } + scope :for_apps, lambda { |apps| where(:app_id.in => apps.all.map(&:id)) } validates_presence_of :last_notice_at, :first_notice_at diff --git a/lib/hoptoad/v2.rb b/lib/hoptoad/v2.rb index db3933a..efcb19f 100644 --- a/lib/hoptoad/v2.rb +++ b/lib/hoptoad/v2.rb @@ -22,13 +22,13 @@ module Hoptoad elsif node.key?('key') { normalize_key(node['key']) => nil } else - node.inject({}) {|rekeyed, (key, val)| rekeyed.merge(normalize_key(key) => rekey(val))} + node.inject({}) { |rekeyed, (key, val)| rekeyed.merge(normalize_key(key) => rekey(val)) } end when Array if node.first.key?('key') - node.inject({}) {|rekeyed, keypair| rekeyed.merge(rekey(keypair))} + node.inject({}) { |rekeyed, keypair| rekeyed.merge(rekey(keypair)) } else - node.map {|n| rekey(n)} + node.map { |n| rekey(n) } end else node diff --git a/spec/controllers/apps_controller_spec.rb b/spec/controllers/apps_controller_spec.rb index 17e23a2..40e3f1f 100644 --- a/spec/controllers/apps_controller_spec.rb +++ b/spec/controllers/apps_controller_spec.rb @@ -61,7 +61,7 @@ describe AppsController, type: 'controller' do it "should not raise errors for app with err without notices" do err - expect{ get :show, :id => app.id }.to_not raise_error + expect { get :show, :id => app.id }.to_not raise_error end it "should list atom feed successfully" do diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 0a2afbe..fe62d6d 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -46,7 +46,7 @@ describe CommentsController, type: 'controller' do end it "should delete the comment" do - expect(problem.comments.detect{|c| c.id.to_s == comment.id }).to be nil + expect(problem.comments.detect { |c| c.id.to_s == comment.id }).to be nil end it "should redirect to problem page" do diff --git a/spec/controllers/problems_controller_spec.rb b/spec/controllers/problems_controller_spec.rb index 0cfa54f..18b0a7e 100644 --- a/spec/controllers/problems_controller_spec.rb +++ b/spec/controllers/problems_controller_spec.rb @@ -326,7 +326,7 @@ describe ProblemsController, type: 'controller' do it "should unmerge a merged problem" do merged_problem = Problem.merge!(@problem1, @problem2) expect(merged_problem.errs.length).to eq 2 - expect{ + expect { post :unmerge_several, :problems => [merged_problem.id.to_s] expect(merged_problem.reload.errs.length).to eq 1 }.to change(Problem, :count).by(1) @@ -370,7 +370,7 @@ describe ProblemsController, type: 'controller' do context "POST /problems/destroy_several" do it "should delete the problems" do - expect{ + expect { post :destroy_several, :problems => [@problem1.id.to_s] }.to change(Problem, :count).by(-1) end diff --git a/spec/controllers/watchers_controller_spec.rb b/spec/controllers/watchers_controller_spec.rb index 3e8d251..8ac42ba 100644 --- a/spec/controllers/watchers_controller_spec.rb +++ b/spec/controllers/watchers_controller_spec.rb @@ -20,7 +20,7 @@ describe WatchersController, type: 'controller' do end it "should delete the watcher" do - expect(app.watchers.detect{|w| w.id.to_s == watcher.id }).to be nil + expect(app.watchers.detect { |w| w.id.to_s == watcher.id }).to be nil end it "should redirect to app page" do diff --git a/spec/fabricators/app_fabricator.rb b/spec/fabricators/app_fabricator.rb index 5b2c3af..d58ddaa 100644 --- a/spec/fabricators/app_fabricator.rb +++ b/spec/fabricators/app_fabricator.rb @@ -1,5 +1,5 @@ Fabricator(:app) do - name { sequence(:app_name){|n| "App ##{n}"} } + name { sequence(:app_name) { |n| "App ##{n}" } } repository_branch 'master' end @@ -12,7 +12,7 @@ end Fabricator(:watcher) do app watcher_type 'email' - email { sequence(:email){|n| "email#{n}@example.com"} } + email { sequence(:email) { |n| "email#{n}@example.com" } } end Fabricator(:user_watcher, :from => :watcher) do diff --git a/spec/fabricators/notice_fabricator.rb b/spec/fabricators/notice_fabricator.rb index d7f2bf0..3a1b5a2 100644 --- a/spec/fabricators/notice_fabricator.rb +++ b/spec/fabricators/notice_fabricator.rb @@ -4,9 +4,9 @@ Fabricator :notice do error_class 'FooError' message 'Too Much Bar' backtrace - server_environment {{ 'environment-name' => 'production' }} - request {{ 'component' => 'foo', 'action' => 'bar' }} - notifier {{ 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }} + server_environment { { 'environment-name' => 'production' } } + request { { 'component' => 'foo', 'action' => 'bar' } } + notifier { { 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' } } after_create do Problem.cache_notice(err.problem_id, self) diff --git a/spec/fabricators/notification_service_fabricator.rb b/spec/fabricators/notification_service_fabricator.rb index bcdb495..269ed63 100644 --- a/spec/fabricators/notification_service_fabricator.rb +++ b/spec/fabricators/notification_service_fabricator.rb @@ -3,7 +3,7 @@ Fabricator :notification_service do room_id { sequence :word } api_token { sequence :word } subdomain { sequence :word } - notify_at_notices { sequence { |_a| [0]} } + notify_at_notices { sequence { |_a| [0] } } end Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do diff --git a/spec/fabricators/sequences_fabricator.rb b/spec/fabricators/sequences_fabricator.rb index 5ec7758..233e7f2 100644 --- a/spec/fabricators/sequences_fabricator.rb +++ b/spec/fabricators/sequences_fabricator.rb @@ -1,2 +1,2 @@ -Fabricate.sequence(:name) {|n| "John #{n} Doe"} -Fabricate.sequence(:word) {|n| "word#{n}"} +Fabricate.sequence(:name) { |n| "John #{n} Doe" } +Fabricate.sequence(:word) { |n| "word#{n}" } diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index 52b895d..84ce6a6 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -1,6 +1,6 @@ Fabricator :user do name 'Clyde Frog' - email { sequence(:user_email) {|n| "user.#{n}@example.com"} } + email { sequence(:user_email) { |n| "user.#{n}@example.com" } } password 'password' password_confirmation 'password' end diff --git a/spec/interactors/problem_merge_spec.rb b/spec/interactors/problem_merge_spec.rb index 372e6f3..88de144 100644 --- a/spec/interactors/problem_merge_spec.rb +++ b/spec/interactors/problem_merge_spec.rb @@ -57,7 +57,7 @@ describe ProblemMerge do it 'merge comment' do expect { problem_merge.merge - }.to change{ + }.to change { problem.comments.size }.from(1).to(2) expect(comment_2.reload.err).to eq problem diff --git a/spec/interactors/user_destroy_spec.rb b/spec/interactors/user_destroy_spec.rb index b3f9025..4668a1c 100644 --- a/spec/interactors/user_destroy_spec.rb +++ b/spec/interactors/user_destroy_spec.rb @@ -17,7 +17,7 @@ describe UserDestroy do it 'should delete watcher' do expect { UserDestroy.new(user).destroy - }.to change{ + }.to change { app.reload.watchers.where(:user_id => user.id).count }.from(1).to(0) end diff --git a/spec/mailers/mailer_spec.rb b/spec/mailers/mailer_spec.rb index ce10d35..23af8b8 100644 --- a/spec/mailers/mailer_spec.rb +++ b/spec/mailers/mailer_spec.rb @@ -85,7 +85,7 @@ describe Mailer do end context 'with a very long message' do - let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) } + let(:notice) { Fabricate(:notice, :message => 6.times.collect { |_a| "0123456789" }.join('')) } it "should truncate the long message" do expect(email.subject).to match(/ \d{47}\.{3}$/) end @@ -99,7 +99,7 @@ describe Mailer do let!(:notice) { Fabricate(:notice) } let!(:comment) { Fabricate(:comment, :err => notice.problem) } let!(:watcher) { Fabricate(:watcher, :app => comment.app) } - let(:recipients) { ['recipient@example.com', 'another@example.com']} + let(:recipients) { ['recipient@example.com', 'another@example.com'] } before do expect(comment).to receive(:notification_recipients).and_return(recipients) diff --git a/spec/models/deploy_spec.rb b/spec/models/deploy_spec.rb index f35a800..4bdf0de 100644 --- a/spec/models/deploy_spec.rb +++ b/spec/models/deploy_spec.rb @@ -17,20 +17,20 @@ describe Deploy, type: 'model' do context 'when the app has resolve_errs_on_deploy set to false' do it 'should not resolve the apps errs' do app = Fabricate(:app, :resolve_errs_on_deploy => false) - @problems = 3.times.map{Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app))} + @problems = 3.times.map { Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app)) } Fabricate(:deploy, :app => app) - expect(app.reload.problems.none?{|problem| problem.resolved?}).to eq true + expect(app.reload.problems.none? { |problem| problem.resolved? }).to eq true end end context 'when the app has resolve_errs_on_deploy set to true' do it 'should resolve the apps errs that were in the same environment' do app = Fabricate(:app, :resolve_errs_on_deploy => true) - @prod_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'production')} - @staging_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging')} + @prod_errs = 3.times.map { Fabricate(:problem, :resolved => false, :app => app, :environment => 'production') } + @staging_errs = 3.times.map { Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging') } Fabricate(:deploy, :app => app, :environment => 'production') - expect(@prod_errs.all?{|problem| problem.reload.resolved?}).to eq true - expect(@staging_errs.all?{|problem| problem.reload.resolved?}).to eq false + expect(@prod_errs.all? { |problem| problem.reload.resolved? }).to eq true + expect(@staging_errs.all? { |problem| problem.reload.resolved? }).to eq false end end end diff --git a/spec/models/error_report_spec.rb b/spec/models/error_report_spec.rb index 814dfbb..690e439 100644 --- a/spec/models/error_report_spec.rb +++ b/spec/models/error_report_spec.rb @@ -17,7 +17,7 @@ module Airbrake end describe ErrorReport do - let(:xml){ + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read } @@ -52,7 +52,7 @@ describe ErrorReport do end context "with a minimal notice" do - let(:xml){ + let(:xml) { Rails.root.join('spec', 'fixtures', 'minimal_test_notice.xml').read } @@ -237,7 +237,7 @@ describe ErrorReport do end context "with xml without request section" do - let(:xml){ + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_request_section.xml').read } it "save a notice" do @@ -250,7 +250,7 @@ describe ErrorReport do end context "with xml with only a single line of backtrace" do - let(:xml){ + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_with_one_line_of_backtrace.xml').read } it "save a notice" do diff --git a/spec/models/notice_observer_spec.rb b/spec/models/notice_observer_spec.rb index cd3c617..25a3b9a 100644 --- a/spec/models/notice_observer_spec.rb +++ b/spec/models/notice_observer_spec.rb @@ -102,7 +102,7 @@ describe "Callback on Notice", type: 'model' do end describe 'send email when notification service is configured but fails' do - let(:notification_service) {Fabricate(:campfire_notification_service)} + let(:notification_service) { Fabricate(:campfire_notification_service) } let(:app) do Fabricate( :app_with_watcher, @@ -130,7 +130,7 @@ describe "Callback on Notice", type: 'model' do describe 'should not send a notification if a notification service is not' \ 'configured' do let(:notification_service) { Fabricate(:notification_service) } - let(:app) { Fabricate(:app, notification_service: notification_service)} + let(:app) { Fabricate(:app, notification_service: notification_service) } let(:notice_attrs) { notice_attrs_for.call(app.api_key) } before { Errbit::Config.per_app_notify_at_notices = true } diff --git a/spec/models/problem_spec.rb b/spec/models/problem_spec.rb index 14bf5a8..17f7a7c 100644 --- a/spec/models/problem_spec.rb +++ b/spec/models/problem_spec.rb @@ -10,7 +10,7 @@ describe Problem, type: 'model' do describe "Fabrication" do context "Fabricate(:problem)" do it 'should have no comment' do - expect{ + expect { Fabricate(:problem) }.to_not change(Comment, :count) end @@ -18,7 +18,7 @@ describe Problem, type: 'model' do context "Fabricate(:problem_with_comments)" do it 'should have 3 comments' do - expect{ + expect { Fabricate(:problem_with_comments) }.to change(Comment, :count).by(3) end @@ -26,7 +26,7 @@ describe Problem, type: 'model' do context "Fabricate(:problem_with_errs)" do it 'should have 3 errs' do - expect{ + expect { Fabricate(:problem_with_errs) }.to change(Err, :count).by(3) end @@ -280,7 +280,7 @@ describe Problem, type: 'model' do Fabricate(:notice, :err => @err, :message => 'ERR 1') @problem.messages = {} @problem.save! - expect {@err.notices.first.destroy}.not_to raise_error + expect { @err.notices.first.destroy }.not_to raise_error end end @@ -412,7 +412,7 @@ describe Problem, type: 'model' do it 'update the notice_count' do expect { problem.recache - }.to change{ + }.to change { problem.notices_count }.from(0).to(1) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1bac201..7fcbb0a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,7 +30,7 @@ require 'errbit_plugin/mock_issue_tracker' # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } Mongoid::Config.truncate! Mongoid::Tasks::Database.create_indexes ActionMailer::Base.delivery_method = :test diff --git a/spec/views/problems/show.html.haml_spec.rb b/spec/views/problems/show.html.haml_spec.rb index a0ac64f..b4e126d 100644 --- a/spec/views/problems/show.html.haml_spec.rb +++ b/spec/views/problems/show.html.haml_spec.rb @@ -113,7 +113,7 @@ describe "problems/show.html.haml", type: 'view' do end context "without issue tracker associate on app" do - let(:problem){ Problem.new(:new_record => false, :app => app) } + let(:problem) { Problem.new(:new_record => false, :app => app) } let(:app) { App.new(:new_record => false) } it 'not see link to create issue' do @@ -129,7 +129,7 @@ describe "problems/show.html.haml", type: 'view' do context "with app having github_repo" do let(:app) { App.new(:new_record => false, :github_repo => 'foo/bar') } - let(:problem){ Problem.new(:new_record => false, :app => app) } + let(:problem) { Problem.new(:new_record => false, :app => app) } before do problem.issue_link = nil -- libgit2 0.21.2