Commit abfb95dae035bdb19fdfea94a663833bb6aae744
1 parent
9725017b
Exists in
master
and in
1 other branch
Rubocop: spaces around and within block braces
Showing
37 changed files
with
67 additions
and
79 deletions
Show diff stats
.rubocop_todo.yml
| @@ -270,18 +270,6 @@ Style/SingleSpaceBeforeFirstArg: | @@ -270,18 +270,6 @@ Style/SingleSpaceBeforeFirstArg: | ||
| 270 | - 'spec/fabricators/notice_fabricator.rb' | 270 | - 'spec/fabricators/notice_fabricator.rb' |
| 271 | - 'spec/fabricators/user_fabricator.rb' | 271 | - 'spec/fabricators/user_fabricator.rb' |
| 272 | 272 | ||
| 273 | -# Offense count: 27 | ||
| 274 | -# Cop supports --auto-correct. | ||
| 275 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
| 276 | -Style/SpaceBeforeBlockBraces: | ||
| 277 | - Enabled: false | ||
| 278 | - | ||
| 279 | -# Offense count: 75 | ||
| 280 | -# Cop supports --auto-correct. | ||
| 281 | -# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. | ||
| 282 | -Style/SpaceInsideBlockBraces: | ||
| 283 | - Enabled: false | ||
| 284 | - | ||
| 285 | # Offense count: 873 | 273 | # Offense count: 873 |
| 286 | # Cop supports --auto-correct. | 274 | # Cop supports --auto-correct. |
| 287 | # Configuration parameters: EnforcedStyle, SupportedStyles. | 275 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
app/controllers/apps_controller.rb
| @@ -39,7 +39,7 @@ class AppsController < ApplicationController | @@ -39,7 +39,7 @@ class AppsController < ApplicationController | ||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | expose(:users) { | 41 | expose(:users) { |
| 42 | - User.all.sort_by {|u| u.name.downcase } | 42 | + User.all.sort_by { |u| u.name.downcase } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | def index; end | 45 | def index; end |
| @@ -96,7 +96,7 @@ protected | @@ -96,7 +96,7 @@ protected | ||
| 96 | # set the app's notification service | 96 | # set the app's notification service |
| 97 | if params[:app][:notification_service_attributes] && (notification_type = params[:app][:notification_service_attributes][:type]) | 97 | if params[:app][:notification_service_attributes] && (notification_type = params[:app][:notification_service_attributes][:type]) |
| 98 | available_notification_classes = [NotificationService] + NotificationService.subclasses | 98 | available_notification_classes = [NotificationService] + NotificationService.subclasses |
| 99 | - notification_class = available_notification_classes.detect{|c| c.name == notification_type} | 99 | + notification_class = available_notification_classes.detect { |c| c.name == notification_type } |
| 100 | if notification_class.present? | 100 | if notification_class.present? |
| 101 | app.notification_service = notification_class.new(params[:app][:notification_service_attributes]) | 101 | app.notification_service = notification_class.new(params[:app][:notification_service_attributes]) |
| 102 | end | 102 | end |
| @@ -116,7 +116,7 @@ protected | @@ -116,7 +116,7 @@ protected | ||
| 116 | # Sanitize negative values, split on comma, | 116 | # Sanitize negative values, split on comma, |
| 117 | # strip, parse as integer, remove all '0's. | 117 | # strip, parse as integer, remove all '0's. |
| 118 | # If empty, set as default and show an error message. | 118 | # If empty, set as default and show an error message. |
| 119 | - email_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i }.reject{|v| v == 0} | 119 | + email_at_notices = val.gsub(/-\d+/, "").split(",").map { |v| v.strip.to_i }.reject { |v| v == 0 } |
| 120 | if email_at_notices.any? | 120 | if email_at_notices.any? |
| 121 | params[:app][:email_at_notices] = email_at_notices | 121 | params[:app][:email_at_notices] = email_at_notices |
| 122 | else | 122 | else |
| @@ -131,7 +131,7 @@ protected | @@ -131,7 +131,7 @@ protected | ||
| 131 | # Sanitize negative values, split on comma, | 131 | # Sanitize negative values, split on comma, |
| 132 | # strip, parse as integer, remove all '0's. | 132 | # strip, parse as integer, remove all '0's. |
| 133 | # If empty, set as default and show an error message. | 133 | # If empty, set as default and show an error message. |
| 134 | - notify_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i } | 134 | + notify_at_notices = val.gsub(/-\d+/, "").split(",").map { |v| v.strip.to_i } |
| 135 | if notify_at_notices.any? | 135 | if notify_at_notices.any? |
| 136 | params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices | 136 | params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices |
| 137 | else | 137 | else |
app/controllers/problems_searcher.rb
| @@ -13,7 +13,7 @@ module ProblemsSearcher | @@ -13,7 +13,7 @@ module ProblemsSearcher | ||
| 13 | end | 13 | end |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | - expose(:params_order){ | 16 | + expose(:params_order) { |
| 17 | unless %w{asc desc}.member?(params[:order]) | 17 | unless %w{asc desc}.member?(params[:order]) |
| 18 | 'desc' | 18 | 'desc' |
| 19 | else | 19 | else |
app/controllers/users_controller.rb
| @@ -65,7 +65,7 @@ protected | @@ -65,7 +65,7 @@ protected | ||
| 65 | def user_permit_params | 65 | def user_permit_params |
| 66 | @user_permit_params ||= [:name, :username, :email, :github_login, :per_page, :time_zone] | 66 | @user_permit_params ||= [:name, :username, :email, :github_login, :per_page, :time_zone] |
| 67 | @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] | 67 | @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] |
| 68 | - @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all?{|pa| !pa.blank? } | 68 | + @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all? { |pa| !pa.blank? } |
| 69 | @user_permit_params | 69 | @user_permit_params |
| 70 | end | 70 | end |
| 71 | 71 |
app/helpers/application_helper.rb
| @@ -56,8 +56,8 @@ module ApplicationHelper | @@ -56,8 +56,8 @@ module ApplicationHelper | ||
| 56 | def create_percentage_table_from_tallies(tallies, options = {}) | 56 | def create_percentage_table_from_tallies(tallies, options = {}) |
| 57 | total = (options[:total] || total_from_tallies(tallies)) | 57 | total = (options[:total] || total_from_tallies(tallies)) |
| 58 | percent = 100.0 / total.to_f | 58 | percent = 100.0 / total.to_f |
| 59 | - rows = tallies.map {|value, count| [(count.to_f * percent), value]}. \ | ||
| 60 | - sort {|a, b| b[0] <=> a[0]} | 59 | + rows = tallies.map { |value, count| [(count.to_f * percent), value] }. \ |
| 60 | + sort { |a, b| b[0] <=> a[0] } | ||
| 61 | render "problems/tally_table", :rows => rows | 61 | render "problems/tally_table", :rows => rows |
| 62 | end | 62 | end |
| 63 | 63 |
app/helpers/apps_helper.rb
| @@ -4,8 +4,8 @@ module AppsHelper | @@ -4,8 +4,8 @@ module AppsHelper | ||
| 4 | html = link_to('copy settings from another app', '#', | 4 | html = link_to('copy settings from another app', '#', |
| 5 | :class => 'button copy_config') | 5 | :class => 'button copy_config') |
| 6 | html << select("duplicate", "app", | 6 | html << select("duplicate", "app", |
| 7 | - App.all.asc(:name).reject{|a| a == @app }. | ||
| 8 | - collect{|p| [p.name, p.id] }, { :include_blank => "[choose app]" }, | 7 | + App.all.asc(:name).reject { |a| a == @app }. |
| 8 | + collect { |p| [p.name, p.id] }, { :include_blank => "[choose app]" }, | ||
| 9 | { :class => "choose_other_app", :style => "display: none;" }) | 9 | { :class => "choose_other_app", :style => "display: none;" }) |
| 10 | return html | 10 | return html |
| 11 | end | 11 | end |
app/helpers/navigation_helper.rb
app/interactors/problem_destroy.rb
| @@ -20,7 +20,7 @@ class ProblemDestroy | @@ -20,7 +20,7 @@ class ProblemDestroy | ||
| 20 | # the number of problem destroy | 20 | # the number of problem destroy |
| 21 | # | 21 | # |
| 22 | def self.execute(problems) | 22 | def self.execute(problems) |
| 23 | - Array(problems).each{ |problem| | 23 | + Array(problems).each { |problem| |
| 24 | ProblemDestroy.new(problem).execute | 24 | ProblemDestroy.new(problem).execute |
| 25 | }.count | 25 | }.count |
| 26 | end | 26 | end |
app/models/app.rb
| @@ -21,7 +21,7 @@ class App | @@ -21,7 +21,7 @@ class App | ||
| 21 | field :_id, | 21 | field :_id, |
| 22 | type: String, | 22 | type: String, |
| 23 | pre_processed: true, | 23 | pre_processed: true, |
| 24 | - default: ->{ BSON::ObjectId.new.to_s } | 24 | + default: -> { BSON::ObjectId.new.to_s } |
| 25 | 25 | ||
| 26 | embeds_many :watchers | 26 | embeds_many :watchers |
| 27 | embeds_many :deploys | 27 | embeds_many :deploys |
app/models/deploy.rb
| @@ -19,7 +19,7 @@ class Deploy | @@ -19,7 +19,7 @@ class Deploy | ||
| 19 | validates_presence_of :username, :environment | 19 | validates_presence_of :username, :environment |
| 20 | 20 | ||
| 21 | def resolve_app_errs | 21 | def resolve_app_errs |
| 22 | - app.problems.unresolved.in_env(environment).each {|problem| problem.resolve!} | 22 | + app.problems.unresolved.in_env(environment).each { |problem| problem.resolve! } |
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | def short_revision | 25 | def short_revision |
app/models/notice.rb
| @@ -26,8 +26,8 @@ class Notice | @@ -26,8 +26,8 @@ class Notice | ||
| 26 | 26 | ||
| 27 | validates_presence_of :backtrace_id, :server_environment, :notifier | 27 | validates_presence_of :backtrace_id, :server_environment, :notifier |
| 28 | 28 | ||
| 29 | - scope :ordered, ->{ order_by(:created_at.asc) } | ||
| 30 | - scope :reverse_ordered, ->{ order_by(:created_at.desc) } | 29 | + scope :ordered, -> { order_by(:created_at.asc) } |
| 30 | + scope :reverse_ordered, -> { order_by(:created_at.desc) } | ||
| 31 | scope :for_errs, Proc.new { |errs| | 31 | scope :for_errs, Proc.new { |errs| |
| 32 | where(:err_id.in => errs.all.map(&:id)) | 32 | where(:err_id.in => errs.all.map(&:id)) |
| 33 | } | 33 | } |
app/models/notification_services/campfire_service.rb
| @@ -17,7 +17,7 @@ if defined? Campy | @@ -17,7 +17,7 @@ if defined? Campy | ||
| 17 | ] | 17 | ] |
| 18 | 18 | ||
| 19 | def check_params | 19 | def check_params |
| 20 | - if FIELDS.detect {|f| self[f[0]].blank? } | 20 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 21 | errors.add :base, 'You must specify your Campfire Subdomain, API token and Room ID' | 21 | errors.add :base, 'You must specify your Campfire Subdomain, API token and Room ID' |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
app/models/notification_services/hoiio_service.rb
| @@ -16,7 +16,7 @@ class NotificationServices::HoiioService < NotificationService | @@ -16,7 +16,7 @@ class NotificationServices::HoiioService < NotificationService | ||
| 16 | ] | 16 | ] |
| 17 | 17 | ||
| 18 | def check_params | 18 | def check_params |
| 19 | - if FIELDS.detect {|f| self[f[0]].blank? } | 19 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 20 | errors.add :base, 'You must specify your App ID, Access Token and Recipient\'s phone numbers' | 20 | errors.add :base, 'You must specify your App ID, Access Token and Recipient\'s phone numbers' |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
app/models/notification_services/hubot_service.rb
| @@ -12,7 +12,7 @@ class NotificationServices::HubotService < NotificationService | @@ -12,7 +12,7 @@ class NotificationServices::HubotService < NotificationService | ||
| 12 | ] | 12 | ] |
| 13 | 13 | ||
| 14 | def check_params | 14 | def check_params |
| 15 | - if FIELDS.detect {|f| self[f[0]].blank? } | 15 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 16 | errors.add :base, 'You must specify the URL of your hubot' | 16 | errors.add :base, 'You must specify the URL of your hubot' |
| 17 | end | 17 | end |
| 18 | end | 18 | end |
app/models/notification_services/pushover_service.rb
| @@ -12,7 +12,7 @@ class NotificationServices::PushoverService < NotificationService | @@ -12,7 +12,7 @@ class NotificationServices::PushoverService < NotificationService | ||
| 12 | ] | 12 | ] |
| 13 | 13 | ||
| 14 | def check_params | 14 | def check_params |
| 15 | - if FIELDS.detect {|f| self[f[0]].blank? } | 15 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 16 | errors.add :base, 'You must specify your User Key and Application API Token.' | 16 | errors.add :base, 'You must specify your User Key and Application API Token.' |
| 17 | end | 17 | end |
| 18 | end | 18 | end |
app/models/notification_services/slack_service.rb
| @@ -8,7 +8,7 @@ class NotificationServices::SlackService < NotificationService | @@ -8,7 +8,7 @@ class NotificationServices::SlackService < NotificationService | ||
| 8 | ] | 8 | ] |
| 9 | 9 | ||
| 10 | def check_params | 10 | def check_params |
| 11 | - if FIELDS.detect {|f| self[f[0]].blank? } | 11 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 12 | errors.add :base, "You must specify your Slack Hook url." | 12 | errors.add :base, "You must specify your Slack Hook url." |
| 13 | end | 13 | end |
| 14 | end | 14 | end |
app/models/notification_services/webhook_service.rb
| @@ -8,7 +8,7 @@ class NotificationServices::WebhookService < NotificationService | @@ -8,7 +8,7 @@ class NotificationServices::WebhookService < NotificationService | ||
| 8 | ] | 8 | ] |
| 9 | 9 | ||
| 10 | def check_params | 10 | def check_params |
| 11 | - if FIELDS.detect {|f| self[f[0]].blank? } | 11 | + if FIELDS.detect { |f| self[f[0]].blank? } |
| 12 | errors.add :base, 'You must specify the URL' | 12 | errors.add :base, 'You must specify the URL' |
| 13 | end | 13 | end |
| 14 | end | 14 | end |
app/models/problem.rb
| @@ -58,10 +58,10 @@ class Problem | @@ -58,10 +58,10 @@ class Problem | ||
| 58 | before_create :cache_app_attributes | 58 | before_create :cache_app_attributes |
| 59 | before_save :truncate_message | 59 | before_save :truncate_message |
| 60 | 60 | ||
| 61 | - scope :resolved, ->{ where(:resolved => true) } | ||
| 62 | - scope :unresolved, ->{ where(:resolved => false) } | ||
| 63 | - scope :ordered, ->{ order_by(:last_notice_at.desc) } | ||
| 64 | - scope :for_apps, lambda {|apps| where(:app_id.in => apps.all.map(&:id))} | 61 | + scope :resolved, -> { where(:resolved => true) } |
| 62 | + scope :unresolved, -> { where(:resolved => false) } | ||
| 63 | + scope :ordered, -> { order_by(:last_notice_at.desc) } | ||
| 64 | + scope :for_apps, lambda { |apps| where(:app_id.in => apps.all.map(&:id)) } | ||
| 65 | 65 | ||
| 66 | validates_presence_of :last_notice_at, :first_notice_at | 66 | validates_presence_of :last_notice_at, :first_notice_at |
| 67 | 67 |
lib/hoptoad/v2.rb
| @@ -22,13 +22,13 @@ module Hoptoad | @@ -22,13 +22,13 @@ module Hoptoad | ||
| 22 | elsif node.key?('key') | 22 | elsif node.key?('key') |
| 23 | { normalize_key(node['key']) => nil } | 23 | { normalize_key(node['key']) => nil } |
| 24 | else | 24 | else |
| 25 | - node.inject({}) {|rekeyed, (key, val)| rekeyed.merge(normalize_key(key) => rekey(val))} | 25 | + node.inject({}) { |rekeyed, (key, val)| rekeyed.merge(normalize_key(key) => rekey(val)) } |
| 26 | end | 26 | end |
| 27 | when Array | 27 | when Array |
| 28 | if node.first.key?('key') | 28 | if node.first.key?('key') |
| 29 | - node.inject({}) {|rekeyed, keypair| rekeyed.merge(rekey(keypair))} | 29 | + node.inject({}) { |rekeyed, keypair| rekeyed.merge(rekey(keypair)) } |
| 30 | else | 30 | else |
| 31 | - node.map {|n| rekey(n)} | 31 | + node.map { |n| rekey(n) } |
| 32 | end | 32 | end |
| 33 | else | 33 | else |
| 34 | node | 34 | node |
spec/controllers/apps_controller_spec.rb
| @@ -61,7 +61,7 @@ describe AppsController, type: 'controller' do | @@ -61,7 +61,7 @@ describe AppsController, type: 'controller' do | ||
| 61 | 61 | ||
| 62 | it "should not raise errors for app with err without notices" do | 62 | it "should not raise errors for app with err without notices" do |
| 63 | err | 63 | err |
| 64 | - expect{ get :show, :id => app.id }.to_not raise_error | 64 | + expect { get :show, :id => app.id }.to_not raise_error |
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | it "should list atom feed successfully" do | 67 | it "should list atom feed successfully" do |
spec/controllers/comments_controller_spec.rb
| @@ -46,7 +46,7 @@ describe CommentsController, type: 'controller' do | @@ -46,7 +46,7 @@ describe CommentsController, type: 'controller' do | ||
| 46 | end | 46 | end |
| 47 | 47 | ||
| 48 | it "should delete the comment" do | 48 | it "should delete the comment" do |
| 49 | - expect(problem.comments.detect{|c| c.id.to_s == comment.id }).to be nil | 49 | + expect(problem.comments.detect { |c| c.id.to_s == comment.id }).to be nil |
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | it "should redirect to problem page" do | 52 | it "should redirect to problem page" do |
spec/controllers/problems_controller_spec.rb
| @@ -326,7 +326,7 @@ describe ProblemsController, type: 'controller' do | @@ -326,7 +326,7 @@ describe ProblemsController, type: 'controller' do | ||
| 326 | it "should unmerge a merged problem" do | 326 | it "should unmerge a merged problem" do |
| 327 | merged_problem = Problem.merge!(@problem1, @problem2) | 327 | merged_problem = Problem.merge!(@problem1, @problem2) |
| 328 | expect(merged_problem.errs.length).to eq 2 | 328 | expect(merged_problem.errs.length).to eq 2 |
| 329 | - expect{ | 329 | + expect { |
| 330 | post :unmerge_several, :problems => [merged_problem.id.to_s] | 330 | post :unmerge_several, :problems => [merged_problem.id.to_s] |
| 331 | expect(merged_problem.reload.errs.length).to eq 1 | 331 | expect(merged_problem.reload.errs.length).to eq 1 |
| 332 | }.to change(Problem, :count).by(1) | 332 | }.to change(Problem, :count).by(1) |
| @@ -370,7 +370,7 @@ describe ProblemsController, type: 'controller' do | @@ -370,7 +370,7 @@ describe ProblemsController, type: 'controller' do | ||
| 370 | 370 | ||
| 371 | context "POST /problems/destroy_several" do | 371 | context "POST /problems/destroy_several" do |
| 372 | it "should delete the problems" do | 372 | it "should delete the problems" do |
| 373 | - expect{ | 373 | + expect { |
| 374 | post :destroy_several, :problems => [@problem1.id.to_s] | 374 | post :destroy_several, :problems => [@problem1.id.to_s] |
| 375 | }.to change(Problem, :count).by(-1) | 375 | }.to change(Problem, :count).by(-1) |
| 376 | end | 376 | end |
spec/controllers/watchers_controller_spec.rb
| @@ -20,7 +20,7 @@ describe WatchersController, type: 'controller' do | @@ -20,7 +20,7 @@ describe WatchersController, type: 'controller' do | ||
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | it "should delete the watcher" do | 22 | it "should delete the watcher" do |
| 23 | - expect(app.watchers.detect{|w| w.id.to_s == watcher.id }).to be nil | 23 | + expect(app.watchers.detect { |w| w.id.to_s == watcher.id }).to be nil |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | it "should redirect to app page" do | 26 | it "should redirect to app page" do |
spec/fabricators/app_fabricator.rb
| 1 | Fabricator(:app) do | 1 | Fabricator(:app) do |
| 2 | - name { sequence(:app_name){|n| "App ##{n}"} } | 2 | + name { sequence(:app_name) { |n| "App ##{n}" } } |
| 3 | repository_branch 'master' | 3 | repository_branch 'master' |
| 4 | end | 4 | end |
| 5 | 5 | ||
| @@ -12,7 +12,7 @@ end | @@ -12,7 +12,7 @@ end | ||
| 12 | Fabricator(:watcher) do | 12 | Fabricator(:watcher) do |
| 13 | app | 13 | app |
| 14 | watcher_type 'email' | 14 | watcher_type 'email' |
| 15 | - email { sequence(:email){|n| "email#{n}@example.com"} } | 15 | + email { sequence(:email) { |n| "email#{n}@example.com" } } |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | Fabricator(:user_watcher, :from => :watcher) do | 18 | Fabricator(:user_watcher, :from => :watcher) do |
spec/fabricators/notice_fabricator.rb
| @@ -4,9 +4,9 @@ Fabricator :notice do | @@ -4,9 +4,9 @@ Fabricator :notice do | ||
| 4 | error_class 'FooError' | 4 | error_class 'FooError' |
| 5 | message 'Too Much Bar' | 5 | message 'Too Much Bar' |
| 6 | backtrace | 6 | backtrace |
| 7 | - server_environment {{ 'environment-name' => 'production' }} | ||
| 8 | - request {{ 'component' => 'foo', 'action' => 'bar' }} | ||
| 9 | - notifier {{ 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }} | 7 | + server_environment { { 'environment-name' => 'production' } } |
| 8 | + request { { 'component' => 'foo', 'action' => 'bar' } } | ||
| 9 | + notifier { { 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' } } | ||
| 10 | 10 | ||
| 11 | after_create do | 11 | after_create do |
| 12 | Problem.cache_notice(err.problem_id, self) | 12 | Problem.cache_notice(err.problem_id, self) |
spec/fabricators/notification_service_fabricator.rb
| @@ -3,7 +3,7 @@ Fabricator :notification_service do | @@ -3,7 +3,7 @@ Fabricator :notification_service do | ||
| 3 | room_id { sequence :word } | 3 | room_id { sequence :word } |
| 4 | api_token { sequence :word } | 4 | api_token { sequence :word } |
| 5 | subdomain { sequence :word } | 5 | subdomain { sequence :word } |
| 6 | - notify_at_notices { sequence { |_a| [0]} } | 6 | + notify_at_notices { sequence { |_a| [0] } } |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do | 9 | Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do |
spec/fabricators/sequences_fabricator.rb
spec/fabricators/user_fabricator.rb
| 1 | Fabricator :user do | 1 | Fabricator :user do |
| 2 | name 'Clyde Frog' | 2 | name 'Clyde Frog' |
| 3 | - email { sequence(:user_email) {|n| "user.#{n}@example.com"} } | 3 | + email { sequence(:user_email) { |n| "user.#{n}@example.com" } } |
| 4 | password 'password' | 4 | password 'password' |
| 5 | password_confirmation 'password' | 5 | password_confirmation 'password' |
| 6 | end | 6 | end |
spec/interactors/problem_merge_spec.rb
| @@ -57,7 +57,7 @@ describe ProblemMerge do | @@ -57,7 +57,7 @@ describe ProblemMerge do | ||
| 57 | it 'merge comment' do | 57 | it 'merge comment' do |
| 58 | expect { | 58 | expect { |
| 59 | problem_merge.merge | 59 | problem_merge.merge |
| 60 | - }.to change{ | 60 | + }.to change { |
| 61 | problem.comments.size | 61 | problem.comments.size |
| 62 | }.from(1).to(2) | 62 | }.from(1).to(2) |
| 63 | expect(comment_2.reload.err).to eq problem | 63 | expect(comment_2.reload.err).to eq problem |
spec/interactors/user_destroy_spec.rb
| @@ -17,7 +17,7 @@ describe UserDestroy do | @@ -17,7 +17,7 @@ describe UserDestroy do | ||
| 17 | it 'should delete watcher' do | 17 | it 'should delete watcher' do |
| 18 | expect { | 18 | expect { |
| 19 | UserDestroy.new(user).destroy | 19 | UserDestroy.new(user).destroy |
| 20 | - }.to change{ | 20 | + }.to change { |
| 21 | app.reload.watchers.where(:user_id => user.id).count | 21 | app.reload.watchers.where(:user_id => user.id).count |
| 22 | }.from(1).to(0) | 22 | }.from(1).to(0) |
| 23 | end | 23 | end |
spec/mailers/mailer_spec.rb
| @@ -85,7 +85,7 @@ describe Mailer do | @@ -85,7 +85,7 @@ describe Mailer do | ||
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | context 'with a very long message' do | 87 | context 'with a very long message' do |
| 88 | - let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) } | 88 | + let(:notice) { Fabricate(:notice, :message => 6.times.collect { |_a| "0123456789" }.join('')) } |
| 89 | it "should truncate the long message" do | 89 | it "should truncate the long message" do |
| 90 | expect(email.subject).to match(/ \d{47}\.{3}$/) | 90 | expect(email.subject).to match(/ \d{47}\.{3}$/) |
| 91 | end | 91 | end |
| @@ -99,7 +99,7 @@ describe Mailer do | @@ -99,7 +99,7 @@ describe Mailer do | ||
| 99 | let!(:notice) { Fabricate(:notice) } | 99 | let!(:notice) { Fabricate(:notice) } |
| 100 | let!(:comment) { Fabricate(:comment, :err => notice.problem) } | 100 | let!(:comment) { Fabricate(:comment, :err => notice.problem) } |
| 101 | let!(:watcher) { Fabricate(:watcher, :app => comment.app) } | 101 | let!(:watcher) { Fabricate(:watcher, :app => comment.app) } |
| 102 | - let(:recipients) { ['recipient@example.com', 'another@example.com']} | 102 | + let(:recipients) { ['recipient@example.com', 'another@example.com'] } |
| 103 | 103 | ||
| 104 | before do | 104 | before do |
| 105 | expect(comment).to receive(:notification_recipients).and_return(recipients) | 105 | expect(comment).to receive(:notification_recipients).and_return(recipients) |
spec/models/deploy_spec.rb
| @@ -17,20 +17,20 @@ describe Deploy, type: 'model' do | @@ -17,20 +17,20 @@ describe Deploy, type: 'model' do | ||
| 17 | context 'when the app has resolve_errs_on_deploy set to false' do | 17 | context 'when the app has resolve_errs_on_deploy set to false' do |
| 18 | it 'should not resolve the apps errs' do | 18 | it 'should not resolve the apps errs' do |
| 19 | app = Fabricate(:app, :resolve_errs_on_deploy => false) | 19 | app = Fabricate(:app, :resolve_errs_on_deploy => false) |
| 20 | - @problems = 3.times.map{Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app))} | 20 | + @problems = 3.times.map { Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app)) } |
| 21 | Fabricate(:deploy, :app => app) | 21 | Fabricate(:deploy, :app => app) |
| 22 | - expect(app.reload.problems.none?{|problem| problem.resolved?}).to eq true | 22 | + expect(app.reload.problems.none? { |problem| problem.resolved? }).to eq true |
| 23 | end | 23 | end |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | context 'when the app has resolve_errs_on_deploy set to true' do | 26 | context 'when the app has resolve_errs_on_deploy set to true' do |
| 27 | it 'should resolve the apps errs that were in the same environment' do | 27 | it 'should resolve the apps errs that were in the same environment' do |
| 28 | app = Fabricate(:app, :resolve_errs_on_deploy => true) | 28 | app = Fabricate(:app, :resolve_errs_on_deploy => true) |
| 29 | - @prod_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'production')} | ||
| 30 | - @staging_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging')} | 29 | + @prod_errs = 3.times.map { Fabricate(:problem, :resolved => false, :app => app, :environment => 'production') } |
| 30 | + @staging_errs = 3.times.map { Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging') } | ||
| 31 | Fabricate(:deploy, :app => app, :environment => 'production') | 31 | Fabricate(:deploy, :app => app, :environment => 'production') |
| 32 | - expect(@prod_errs.all?{|problem| problem.reload.resolved?}).to eq true | ||
| 33 | - expect(@staging_errs.all?{|problem| problem.reload.resolved?}).to eq false | 32 | + expect(@prod_errs.all? { |problem| problem.reload.resolved? }).to eq true |
| 33 | + expect(@staging_errs.all? { |problem| problem.reload.resolved? }).to eq false | ||
| 34 | end | 34 | end |
| 35 | end | 35 | end |
| 36 | end | 36 | end |
spec/models/error_report_spec.rb
| @@ -17,7 +17,7 @@ module Airbrake | @@ -17,7 +17,7 @@ module Airbrake | ||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | describe ErrorReport do | 19 | describe ErrorReport do |
| 20 | - let(:xml){ | 20 | + let(:xml) { |
| 21 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read | 21 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read |
| 22 | } | 22 | } |
| 23 | 23 | ||
| @@ -52,7 +52,7 @@ describe ErrorReport do | @@ -52,7 +52,7 @@ describe ErrorReport do | ||
| 52 | end | 52 | end |
| 53 | 53 | ||
| 54 | context "with a minimal notice" do | 54 | context "with a minimal notice" do |
| 55 | - let(:xml){ | 55 | + let(:xml) { |
| 56 | Rails.root.join('spec', 'fixtures', 'minimal_test_notice.xml').read | 56 | Rails.root.join('spec', 'fixtures', 'minimal_test_notice.xml').read |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -237,7 +237,7 @@ describe ErrorReport do | @@ -237,7 +237,7 @@ describe ErrorReport do | ||
| 237 | end | 237 | end |
| 238 | 238 | ||
| 239 | context "with xml without request section" do | 239 | context "with xml without request section" do |
| 240 | - let(:xml){ | 240 | + let(:xml) { |
| 241 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_request_section.xml').read | 241 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_request_section.xml').read |
| 242 | } | 242 | } |
| 243 | it "save a notice" do | 243 | it "save a notice" do |
| @@ -250,7 +250,7 @@ describe ErrorReport do | @@ -250,7 +250,7 @@ describe ErrorReport do | ||
| 250 | end | 250 | end |
| 251 | 251 | ||
| 252 | context "with xml with only a single line of backtrace" do | 252 | context "with xml with only a single line of backtrace" do |
| 253 | - let(:xml){ | 253 | + let(:xml) { |
| 254 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_with_one_line_of_backtrace.xml').read | 254 | Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_with_one_line_of_backtrace.xml').read |
| 255 | } | 255 | } |
| 256 | it "save a notice" do | 256 | it "save a notice" do |
spec/models/notice_observer_spec.rb
| @@ -102,7 +102,7 @@ describe "Callback on Notice", type: 'model' do | @@ -102,7 +102,7 @@ describe "Callback on Notice", type: 'model' do | ||
| 102 | end | 102 | end |
| 103 | 103 | ||
| 104 | describe 'send email when notification service is configured but fails' do | 104 | describe 'send email when notification service is configured but fails' do |
| 105 | - let(:notification_service) {Fabricate(:campfire_notification_service)} | 105 | + let(:notification_service) { Fabricate(:campfire_notification_service) } |
| 106 | let(:app) do | 106 | let(:app) do |
| 107 | Fabricate( | 107 | Fabricate( |
| 108 | :app_with_watcher, | 108 | :app_with_watcher, |
| @@ -130,7 +130,7 @@ describe "Callback on Notice", type: 'model' do | @@ -130,7 +130,7 @@ describe "Callback on Notice", type: 'model' do | ||
| 130 | describe 'should not send a notification if a notification service is not' \ | 130 | describe 'should not send a notification if a notification service is not' \ |
| 131 | 'configured' do | 131 | 'configured' do |
| 132 | let(:notification_service) { Fabricate(:notification_service) } | 132 | let(:notification_service) { Fabricate(:notification_service) } |
| 133 | - let(:app) { Fabricate(:app, notification_service: notification_service)} | 133 | + let(:app) { Fabricate(:app, notification_service: notification_service) } |
| 134 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } | 134 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } |
| 135 | 135 | ||
| 136 | before { Errbit::Config.per_app_notify_at_notices = true } | 136 | before { Errbit::Config.per_app_notify_at_notices = true } |
spec/models/problem_spec.rb
| @@ -10,7 +10,7 @@ describe Problem, type: 'model' do | @@ -10,7 +10,7 @@ describe Problem, type: 'model' do | ||
| 10 | describe "Fabrication" do | 10 | describe "Fabrication" do |
| 11 | context "Fabricate(:problem)" do | 11 | context "Fabricate(:problem)" do |
| 12 | it 'should have no comment' do | 12 | it 'should have no comment' do |
| 13 | - expect{ | 13 | + expect { |
| 14 | Fabricate(:problem) | 14 | Fabricate(:problem) |
| 15 | }.to_not change(Comment, :count) | 15 | }.to_not change(Comment, :count) |
| 16 | end | 16 | end |
| @@ -18,7 +18,7 @@ describe Problem, type: 'model' do | @@ -18,7 +18,7 @@ describe Problem, type: 'model' do | ||
| 18 | 18 | ||
| 19 | context "Fabricate(:problem_with_comments)" do | 19 | context "Fabricate(:problem_with_comments)" do |
| 20 | it 'should have 3 comments' do | 20 | it 'should have 3 comments' do |
| 21 | - expect{ | 21 | + expect { |
| 22 | Fabricate(:problem_with_comments) | 22 | Fabricate(:problem_with_comments) |
| 23 | }.to change(Comment, :count).by(3) | 23 | }.to change(Comment, :count).by(3) |
| 24 | end | 24 | end |
| @@ -26,7 +26,7 @@ describe Problem, type: 'model' do | @@ -26,7 +26,7 @@ describe Problem, type: 'model' do | ||
| 26 | 26 | ||
| 27 | context "Fabricate(:problem_with_errs)" do | 27 | context "Fabricate(:problem_with_errs)" do |
| 28 | it 'should have 3 errs' do | 28 | it 'should have 3 errs' do |
| 29 | - expect{ | 29 | + expect { |
| 30 | Fabricate(:problem_with_errs) | 30 | Fabricate(:problem_with_errs) |
| 31 | }.to change(Err, :count).by(3) | 31 | }.to change(Err, :count).by(3) |
| 32 | end | 32 | end |
| @@ -280,7 +280,7 @@ describe Problem, type: 'model' do | @@ -280,7 +280,7 @@ describe Problem, type: 'model' do | ||
| 280 | Fabricate(:notice, :err => @err, :message => 'ERR 1') | 280 | Fabricate(:notice, :err => @err, :message => 'ERR 1') |
| 281 | @problem.messages = {} | 281 | @problem.messages = {} |
| 282 | @problem.save! | 282 | @problem.save! |
| 283 | - expect {@err.notices.first.destroy}.not_to raise_error | 283 | + expect { @err.notices.first.destroy }.not_to raise_error |
| 284 | end | 284 | end |
| 285 | end | 285 | end |
| 286 | 286 | ||
| @@ -412,7 +412,7 @@ describe Problem, type: 'model' do | @@ -412,7 +412,7 @@ describe Problem, type: 'model' do | ||
| 412 | it 'update the notice_count' do | 412 | it 'update the notice_count' do |
| 413 | expect { | 413 | expect { |
| 414 | problem.recache | 414 | problem.recache |
| 415 | - }.to change{ | 415 | + }.to change { |
| 416 | problem.notices_count | 416 | problem.notices_count |
| 417 | }.from(0).to(1) | 417 | }.from(0).to(1) |
| 418 | end | 418 | end |
spec/spec_helper.rb
| @@ -30,7 +30,7 @@ require 'errbit_plugin/mock_issue_tracker' | @@ -30,7 +30,7 @@ require 'errbit_plugin/mock_issue_tracker' | ||
| 30 | 30 | ||
| 31 | # Requires supporting files with custom matchers and macros, etc, | 31 | # Requires supporting files with custom matchers and macros, etc, |
| 32 | # in ./support/ and its subdirectories. | 32 | # in ./support/ and its subdirectories. |
| 33 | -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} | 33 | +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } |
| 34 | Mongoid::Config.truncate! | 34 | Mongoid::Config.truncate! |
| 35 | Mongoid::Tasks::Database.create_indexes | 35 | Mongoid::Tasks::Database.create_indexes |
| 36 | ActionMailer::Base.delivery_method = :test | 36 | ActionMailer::Base.delivery_method = :test |
spec/views/problems/show.html.haml_spec.rb
| @@ -113,7 +113,7 @@ describe "problems/show.html.haml", type: 'view' do | @@ -113,7 +113,7 @@ describe "problems/show.html.haml", type: 'view' do | ||
| 113 | end | 113 | end |
| 114 | 114 | ||
| 115 | context "without issue tracker associate on app" do | 115 | context "without issue tracker associate on app" do |
| 116 | - let(:problem){ Problem.new(:new_record => false, :app => app) } | 116 | + let(:problem) { Problem.new(:new_record => false, :app => app) } |
| 117 | let(:app) { App.new(:new_record => false) } | 117 | let(:app) { App.new(:new_record => false) } |
| 118 | 118 | ||
| 119 | it 'not see link to create issue' do | 119 | it 'not see link to create issue' do |
| @@ -129,7 +129,7 @@ describe "problems/show.html.haml", type: 'view' do | @@ -129,7 +129,7 @@ describe "problems/show.html.haml", type: 'view' do | ||
| 129 | 129 | ||
| 130 | context "with app having github_repo" do | 130 | context "with app having github_repo" do |
| 131 | let(:app) { App.new(:new_record => false, :github_repo => 'foo/bar') } | 131 | let(:app) { App.new(:new_record => false, :github_repo => 'foo/bar') } |
| 132 | - let(:problem){ Problem.new(:new_record => false, :app => app) } | 132 | + let(:problem) { Problem.new(:new_record => false, :app => app) } |
| 133 | 133 | ||
| 134 | before do | 134 | before do |
| 135 | problem.issue_link = nil | 135 | problem.issue_link = nil |