Commit 1c7cb82a686991dd04dacae3a9f90d04ee87f54f

Authored by Stephen Crosby
2 parents 06569f9d ed97fdfe
Exists in master and in 1 other branch production

Merge pull request #979 from rud/chore/rubocop-newline-fixes

Chore/rubocop newline fixes
Showing 64 changed files with 34 additions and 162 deletions   Show diff stats
.rubocop.yml
... ... @@ -8,3 +8,9 @@ AllCops:
8 8 # returns nil
9 9 Rails/FindBy:
10 10 Enabled: false
  11 +
  12 +Style/EmptyLineBetweenDefs:
  13 + AllowAdjacentOneLineDefs: true
  14 +
  15 +Style/ExtraSpacing:
  16 + AllowForAlignment: true
... ...
.rubocop_todo.yml
... ... @@ -147,67 +147,6 @@ Style/EachWithObject:
147 147 - 'app/models/notice_fingerprinter.rb'
148 148 - 'lib/recurse.rb'
149 149  
150   -# Offense count: 14
151   -# Cop supports --auto-correct.
152   -# Configuration parameters: AllowAdjacentOneLineDefs.
153   -Style/EmptyLineBetweenDefs:
154   - Exclude:
155   - - 'app/controllers/apps_controller.rb'
156   - - 'app/controllers/users_controller.rb'
157   - - 'app/models/notification_service.rb'
158   - - 'spec/decorators/issue_tracker_decorator_spec.rb'
159   - - 'spec/decorators/issue_tracker_type_decorator_spec.rb'
160   - - 'spec/views/problems/show.html.haml_spec.rb'
161   -
162   -# Offense count: 12
163   -# Cop supports --auto-correct.
164   -Style/EmptyLines:
165   - Exclude:
166   - - 'app/controllers/api/v1/stats_controller.rb'
167   - - 'app/decorators/issue_tracker_field_decorator.rb'
168   - - 'app/models/app.rb'
169   - - 'app/models/problem.rb'
170   - - 'config/deploy/production.example.rb'
171   - - 'lib/tasks/errbit/demo.rake'
172   - - 'script/rspec-queue-mongoid.rb'
173   - - 'spec/acceptance/app_regenerate_api_key_spec.rb'
174   -
175   -# Offense count: 28
176   -# Cop supports --auto-correct.
177   -# Configuration parameters: EnforcedStyle, SupportedStyles.
178   -Style/EmptyLinesAroundBlockBody:
179   - Enabled: false
180   -
181   -# Offense count: 26
182   -# Cop supports --auto-correct.
183   -# Configuration parameters: EnforcedStyle, SupportedStyles.
184   -Style/EmptyLinesAroundClassBody:
185   - Enabled: false
186   -
187   -# Offense count: 2
188   -# Cop supports --auto-correct.
189   -Style/EmptyLinesAroundMethodBody:
190   - Exclude:
191   - - 'app/models/notification_services/hoiio_service.rb'
192   - - 'app/models/notification_services/pushover_service.rb'
193   -
194   -# Offense count: 9
195   -# Cop supports --auto-correct.
196   -# Configuration parameters: EnforcedStyle, SupportedStyles.
197   -Style/EmptyLinesAroundModuleBody:
198   - Exclude:
199   - - 'app/helpers/application_helper.rb'
200   - - 'app/helpers/form_helper.rb'
201   - - 'app/helpers/hash_helper.rb'
202   - - 'app/helpers/navigation_helper.rb'
203   - - 'app/helpers/sort_helper.rb'
204   -
205   -# Offense count: 22
206   -# Cop supports --auto-correct.
207   -# Configuration parameters: AllowForAlignment.
208   -Style/ExtraSpacing:
209   - Enabled: false
210   -
211 150 # Offense count: 2
212 151 # Configuration parameters: Exclude.
213 152 Style/FileName:
... ...
Gemfile
... ... @@ -29,7 +29,7 @@ gem 'htmlentities'
29 29 gem 'kaminari', '>= 0.14.1'
30 30 gem 'mongoid', '5.0.0'
31 31 gem 'mongoid_rails_migrations'
32   -gem 'rack-ssl', :require => 'rack/ssl' # force SSL
  32 +gem 'rack-ssl', :require => 'rack/ssl' # force SSL
33 33 gem 'rack-ssl-enforcer', :require => false
34 34 gem 'rails_autolink'
35 35 gem 'useragent'
... ... @@ -104,7 +104,7 @@ group :heroku, :production do
104 104 gem 'unicorn', require: false, platform: 'ruby'
105 105 end
106 106  
107   -gem 'therubyracer', :platform => :ruby # C Ruby (MRI) or Rubinius, but NOT Windows
  107 +gem 'therubyracer', :platform => :ruby # C Ruby (MRI) or Rubinius, but NOT Windows
108 108 gem 'sass-rails'
109 109 gem 'uglifier'
110 110 # We can't upgrade because not compatible to jquery >= 1.9.
... ...
app/controllers/api/v1/notices_controller.rb
... ... @@ -17,8 +17,7 @@ class Api::V1::NoticesController < ApplicationController
17 17  
18 18 respond_to do |format|
19 19 format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path
20   - format.xml { render :xml => results }
  20 + format.xml { render :xml => results }
21 21 end
22 22 end
23   -
24 23 end
... ...
app/controllers/api/v1/problems_controller.rb
... ... @@ -14,7 +14,7 @@ class Api::V1::ProblemsController < ApplicationController
14 14  
15 15 respond_to do |format|
16 16 format.any(:html, :json) { render :json => result } # render JSON if no extension specified on path
17   - format.xml { render :xml => result }
  17 + format.xml { render :xml => result }
18 18 end
19 19 end
20 20  
... ... @@ -33,8 +33,7 @@ class Api::V1::ProblemsController < ApplicationController
33 33  
34 34 respond_to do |format|
35 35 format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path
36   - format.xml { render :xml => results }
  36 + format.xml { render :xml => results }
37 37 end
38 38 end
39   -
40 39 end
... ...
app/controllers/api/v1/stats_controller.rb
... ... @@ -19,11 +19,10 @@ class Api::V1::StatsController < ApplicationController
19 19  
20 20 respond_to do |format|
21 21 format.any(:html, :json) { render :json => JSON.dump(stats) } # render JSON if no extension specified on path
22   - format.xml { render :xml => stats }
  22 + format.xml { render :xml => stats }
23 23 end
24 24 end
25 25  
26   -
27 26 protected
28 27  
29 28 def require_api_key_or_authenticate_user!
... ... @@ -35,5 +34,4 @@ class Api::V1::StatsController < ApplicationController
35 34  
36 35 authenticate_user!
37 36 end
38   -
39 37 end
... ...
app/controllers/apps_controller.rb
1 1 class AppsController < ApplicationController
2   -
3 2 include ProblemsSearcher
4 3  
5 4 before_action :require_admin!, :except => [:index, :show]
... ... @@ -44,6 +43,7 @@ class AppsController &lt; ApplicationController
44 43 }
45 44  
46 45 def index; end
  46 +
47 47 def show
48 48 app
49 49 end
... ...
app/controllers/deploys_controller.rb
1 1 class DeploysController < ApplicationController
2   -
3 2 protect_from_forgery :except => :create
4 3  
5 4 skip_before_action :verify_authenticity_token, :only => :create
... ... @@ -40,6 +39,5 @@ class DeploysController &lt; ApplicationController
40 39 :revision => params[:head],
41 40 }
42 41 end
43   -
44 42 end
45 43  
... ...
app/controllers/notices_controller.rb
1 1 class NoticesController < ApplicationController
2   -
3 2 class ParamsError < StandardError; end
4 3  
5 4 skip_before_action :authenticate_user!, only: :create
... ... @@ -48,5 +47,4 @@ class NoticesController &lt; ApplicationController
48 47 def bad_params(exception)
49 48 render :text => exception.message, :status => :bad_request
50 49 end
51   -
52 50 end
... ...
app/controllers/problems_controller.rb
... ... @@ -5,7 +5,6 @@
5 5 # MEMBER => :show, :edit, :update, :create, :destroy, :resolve, :unresolve, :create_issue, :unlink_issue
6 6 # COLLECTION => :index, :all, :destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several, :search
7 7 class ProblemsController < ApplicationController
8   -
9 8 include ProblemsSearcher
10 9  
11 10 before_action :need_selected_problem, :only => [
... ...
app/controllers/problems_searcher.rb
... ... @@ -5,7 +5,6 @@ module ProblemsSearcher
5 5 extend ActiveSupport::Concern
6 6  
7 7 included do
8   -
9 8 expose(:params_sort) {
10 9 unless %w{app message last_notice_at last_deploy_at count}.member?(params[:sort])
11 10 "last_notice_at"
... ... @@ -29,6 +28,5 @@ module ProblemsSearcher
29 28 expose(:err_ids) {
30 29 (params[:problems] || []).compact
31 30 }
32   -
33 31 end
34 32 end
... ...
app/controllers/users_controller.rb
... ... @@ -72,6 +72,5 @@ class UsersController &lt; ApplicationController
72 72 def user_password_params
73 73 @user_password_params ||= params[:user] ? params.require(:user).permit(:password, :password_confirmation) : {}
74 74 end
75   -
76 75 end
77 76  
... ...
app/decorators/app_decorator.rb
1 1 class AppDecorator < Draper::Decorator
2   -
3 2 decorates_association :watchers
4 3 decorates_association :issue_tracker, :with => IssueTrackerDecorator
5 4 delegate_all
... ... @@ -15,5 +14,4 @@ class AppDecorator &lt; Draper::Decorator
15 14 def notify_err_display
16 15 object.notify_on_errs ? '' : 'display: none;'
17 16 end
18   -
19 17 end
... ...
app/decorators/issue_tracker_field_decorator.rb
1 1 class IssueTrackerFieldDecorator < Draper::Decorator
2   -
3 2 def initialize(field, field_info)
4 3 @object = field
5 4 @field_info = field_info
... ... @@ -12,7 +11,6 @@ class IssueTrackerFieldDecorator &lt; Draper::Decorator
12 11 field_info[:label] || object.to_s.titleize
13 12 end
14 13  
15   -
16 14 def input(form, issue_tracker)
17 15 form.send(input_field, key.to_s,
18 16 :placeholder => field_info[:placeholder],
... ...
app/decorators/watcher_decorator.rb
1 1 class WatcherDecorator < Draper::Decorator
2   -
3 2 delegate_all
4 3  
5 4 def email_choosen
6 5 object.email.blank? ? 'chosen' : ''
7 6 end
8   -
9 7 end
... ...
app/helpers/application_helper.rb
... ... @@ -84,5 +84,4 @@ module ApplicationHelper
84 84 def head_size
85 85 4
86 86 end
87   -
88 87 end
... ...
app/helpers/apps_helper.rb
... ... @@ -42,10 +42,10 @@ module AppsHelper
42 42 @any_github_repos = @any_issue_trackers = @any_deploys = @any_bitbucket_repos = @any_notification_services = false
43 43  
44 44 apps.each do |app|
45   - @any_github_repos ||= app.github_repo?
46   - @any_bitbucket_repos ||= app.bitbucket_repo?
47   - @any_issue_trackers ||= app.issue_tracker_configured?
48   - @any_deploys ||= app.last_deploy_at.present?
  45 + @any_github_repos ||= app.github_repo?
  46 + @any_bitbucket_repos ||= app.bitbucket_repo?
  47 + @any_issue_trackers ||= app.issue_tracker_configured?
  48 + @any_deploys ||= app.last_deploy_at.present?
49 49 @any_notification_services ||= app.notification_service_configured?
50 50 end
51 51 end
... ...
app/helpers/form_helper.rb
1 1 module FormHelper
2   -
3 2 def errors_for(document)
4 3 return unless document.errors.any?
5 4  
6 5 content_tag(:div, :class => 'error-messages') do
7   - body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.')
  6 + body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.')
8 7 body + content_tag(:ul) do
9 8 document.errors.full_messages.inject('') {|errs, msg| errs + content_tag(:li, h(msg)) }.html_safe
10 9 end
... ... @@ -14,5 +13,4 @@ module FormHelper
14 13 def label_for_attr(builder, field)
15 14 (builder.object_name + field).gsub(/[\[\]]/,'_').squeeze('_')
16 15 end
17   -
18 16 end
... ...
app/helpers/hash_helper.rb
1 1 module HashHelper
2   -
3 2 def pretty_hash(hash, nesting = 0)
4 3 return '{}' if hash.empty?
5 4  
... ... @@ -13,10 +12,8 @@ module HashHelper
13 12 pretty += "\n#{' '*nesting*tab_size}"
14 13 pretty += "#{key.inspect} => #{val}"
15 14 pretty += "," unless key == sorted_keys.last
16   -
17 15 end
18 16 nesting -= 1
19 17 pretty += "\n#{' '*nesting*tab_size}}"
20 18 end
21   -
22 19 end
... ...
app/helpers/navigation_helper.rb
1 1 module NavigationHelper
2   -
3 2 # Returns ' active' if you are on a given controller
4 3 # - active_if_here(:users) => ' active' if users controller
5 4 # Or on one of a list of controllers
... ... @@ -44,5 +43,4 @@ module NavigationHelper
44 43 def page_count_from_end(current_page, total_pages)
45 44 (total_pages.to_i - current_page.to_i) + 1
46 45 end
47   -
48 46 end
... ...
app/helpers/sort_helper.rb
1 1 # encoding: utf-8
2 2 module SortHelper
3   -
4 3 def link_for_sort(name, field=nil)
5 4 field ||= name.underscore
6 5 current = (params_sort == field)
... ... @@ -10,5 +9,4 @@ module SortHelper
10 9 options.merge!(:class => "current #{order}") if current
11 10 link_to(name, url, options)
12 11 end
13   -
14 12 end
... ...
app/interactors/problem_destroy.rb
1 1 class ProblemDestroy
2   -
3 2 attr_reader :problem
4 3  
5 4 def initialize(problem)
... ... @@ -44,5 +43,4 @@ class ProblemDestroy
44 43 def delete_comments
45 44 Comment.delete_all(:_id => { '$in' => comments_id })
46 45 end
47   -
48 46 end
... ...
app/interactors/resolved_problem_clearer.rb
1 1 require 'problem_destroy'
2 2  
3 3 class ResolvedProblemClearer
4   -
5 4 ##
6 5 # Clear all problem already resolved
7 6 #
... ...
app/mailers/mailer.rb
... ... @@ -28,8 +28,8 @@ class Mailer &lt; ActionMailer::Base
28 28 end
29 29  
30 30 def deploy_notification(deploy)
31   - @deploy = deploy
32   - @app = AppDecorator.new deploy.app
  31 + @deploy = deploy
  32 + @app = AppDecorator.new deploy.app
33 33  
34 34 errbit_headers 'App' => @app.name,
35 35 'Environment' => @deploy.environment,
... ...
app/models/app.rb
... ... @@ -89,7 +89,6 @@ class App
89 89 (last_deploy = deploys.last) && last_deploy.created_at
90 90 end
91 91  
92   -
93 92 # Legacy apps don't have notify_on_errs and notify_on_deploys params
94 93 def notify_on_errs
95 94 !(super == false)
... ... @@ -133,7 +132,6 @@ class App
133 132 "#{bitbucket_url}/src/#{repo_branch}/#{file}"
134 133 end
135 134  
136   -
137 135 def issue_tracker_configured?
138 136 issue_tracker.present? && issue_tracker.configured?
139 137 end
... ... @@ -143,7 +141,6 @@ class App
143 141 notification_service.configured?
144 142 end
145 143  
146   -
147 144 def notification_recipients
148 145 if notify_all_users
149 146 (User.all.map(&:email).reject(&:blank?) + watchers.map(&:address)).uniq
... ... @@ -220,6 +217,5 @@ class App
220 217 github_repo.sub!(/(git@|https?:\/\/)#{github_host}(\/|:)/, '')
221 218 github_repo.sub!(/\.git$/, '')
222 219 end
223   -
224 220 end
225 221  
... ...
app/models/comment.rb
... ... @@ -37,5 +37,4 @@ class Comment
37 37 def decrease_counter_cache
38 38 err.inc(comments_count: -1) if err
39 39 end
40   -
41 40 end
... ...
app/models/deploy.rb
... ... @@ -43,6 +43,5 @@ class Deploy
43 43 Mailer.deploy_notification(self).deliver_now
44 44 end
45 45 end
46   -
47 46 end
48 47  
... ...
app/models/err.rb
... ... @@ -17,5 +17,4 @@ class Err
17 17 validates_presence_of :problem_id, :fingerprint
18 18  
19 19 delegate :app, :resolved?, :to => :problem
20   -
21 20 end
... ...
app/models/issue_tracker.rb
... ... @@ -22,7 +22,7 @@ class IssueTracker
22 22 end
23 23  
24 24 def type_tracker
25   - attributes['type_tracker'] ? attributes['type_tracker'] : 'none'
  25 + attributes['type_tracker'] ? attributes['type_tracker'] : 'none'
26 26 end
27 27  
28 28 # Allow the tracker to validate its own params
... ...
app/models/notification_services/gtalk_service.rb
... ... @@ -46,7 +46,7 @@ class NotificationServices::GtalkService &lt; NotificationService
46 46 client.auth(api_token)
47 47  
48 48 #has to look like this to be formatted properly in the client
49   - message = """#{problem.app.name}
  49 + message = """#{problem.app.name}
50 50 #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}
51 51 #{notification_description problem}"""
52 52  
... ...
app/models/notification_services/hoiio_service.rb
... ... @@ -37,6 +37,5 @@ class NotificationServices::HoiioService &lt; NotificationService
37 37 room_id.split(',').each do |number|
38 38 sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}"
39 39 end
40   -
41 40 end
42 41 end
... ...
app/models/notification_services/pushover_service.rb
... ... @@ -27,6 +27,5 @@ class NotificationServices::PushoverService &lt; NotificationService
27 27  
28 28 # send push notification to pushover
29 29 notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}", :url_title => "Link to error")
30   -
31 30 end
32 31 end
... ...
app/models/problem.rb
... ... @@ -12,7 +12,6 @@ class Problem
12 12 user_agents: :user_agent_string
13 13 }.freeze
14 14  
15   -
16 15 field :last_notice_at, :type => ActiveSupport::TimeWithZone, :default => Proc.new { Time.zone.now }
17 16 field :first_notice_at, :type => ActiveSupport::TimeWithZone, :default => Proc.new { Time.zone.now }
18 17 field :last_deploy_at, :type => Time
... ... @@ -186,7 +185,6 @@ class Problem
186 185 !resolved?
187 186 end
188 187  
189   -
190 188 def self.merge!(*problems)
191 189 ProblemMerge.new(problems).merge
192 190 end
... ...
app/models/watcher.rb
... ... @@ -39,6 +39,5 @@ class Watcher
39 39 self.user = self.user_id = nil
40 40 end
41 41 end
42   -
43 42 end
44 43  
... ...
bin/rails
1 1 #!/usr/bin/env ruby
2 2 # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3 3  
4   -APP_PATH = File.expand_path('../../config/application', __FILE__)
5   -require File.expand_path('../../config/boot', __FILE__)
  4 +APP_PATH = File.expand_path('../../config/application', __FILE__)
  5 +require File.expand_path('../../config/boot', __FILE__)
6 6 require 'rails/commands'
... ...
config.ru
1 1 # This file is used by Rack-based servers to start the application.
2 2  
3   -require ::File.expand_path('../config/environment', __FILE__)
  3 +require ::File.expand_path('../config/environment', __FILE__)
4 4 use Rack::Deflater
5 5 run Rails.application
... ...
config/deploy/production.example.rb
... ... @@ -8,7 +8,6 @@ role :app, %w(deploy@example.com)
8 8 role :web, %w(deploy@example.com)
9 9 role :db, %w(deploy@example.com)
10 10  
11   -
12 11 # Extended Server Syntax
13 12 # ======================
14 13 # This can be used to drop a more detailed server definition into the
... ... @@ -17,7 +16,6 @@ role :db, %w(deploy@example.com)
17 16  
18 17 server 'example.com', user: 'deploy', roles: %w(web app), my_property: :my_value
19 18  
20   -
21 19 # Custom SSH Options
22 20 # ==================
23 21 # You may pass any option but keep in mind that net/ssh understands a
... ...
config/routes.rb
1 1 Rails.application.routes.draw do
2   -
3 2 devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
4 3  
5 4 # Hoptoad Notifier Routes
... ... @@ -21,7 +20,7 @@ Rails.application.routes.draw do
21 20 end
22 21 end
23 22  
24   - resources :problems, :only => [:index] do
  23 + resources :problems, :only => [:index] do
25 24 collection do
26 25 post :destroy_several
27 26 post :resolve_several
... ...
lib/configurator.rb
... ... @@ -4,7 +4,6 @@ require &#39;ostruct&#39;
4 4 # order to provide a consistent way to use configuration throughout your
5 5 # application
6 6 class Configurator
7   -
8 7 # Run the configurator and return the processed values
9 8 #
10 9 # @example Simple mapping
... ...
lib/hoptoad.rb
... ... @@ -18,7 +18,7 @@ module Hoptoad
18 18 def self.get_version_processor(version)
19 19 case version
20 20 when /2\.[01234]/ then Hoptoad::V2
21   - else; raise ApiVersionError
  21 + else; raise ApiVersionError
22 22 end
23 23 end
24 24 end
... ...
lib/recurse.rb
1 1 class Hash
2   -
3 2 # Apply a block to hash, and recursively apply that block
4 3 # to each sub-hash or +types+.
5 4 #
... ... @@ -20,6 +19,5 @@ class Hash
20 19 end
21 20 yield h
22 21 end
23   -
24 22 end
25 23  
... ...
lib/tasks/errbit/demo.rake
... ... @@ -64,7 +64,6 @@ namespace :errbit do
64 64 end
65 65 end
66 66  
67   -
68 67 Fabricate(:notice, :err => Fabricate(:err, :problem => Fabricate(:problem, :app => app)))
69 68 puts "=== Created demo app: '#{app.name}', with example errors."
70 69 end
... ...
script/rspec-queue-mongoid.rb
... ... @@ -5,7 +5,6 @@ require &#39;bundler&#39;
5 5 Bundler.setup(:default, :development, :test)
6 6 require 'test_queue/runner/rspec'
7 7  
8   -
9 8 class MongoidRspecRunner < TestQueue::Runner::RSpec
10 9 def after_fork(num)
11 10 super
... ...
spec/acceptance/app_regenerate_api_key_spec.rb
... ... @@ -35,7 +35,6 @@ feature &quot;Regeneration api_Key&quot; do
35 35 end
36 36  
37 37 feature "Create an application" do
38   -
39 38 let(:admin) { Fabricate(:admin) }
40 39 let(:user) {
41 40 Fabricate(:user_watcher, :app => app).user
... ... @@ -55,7 +54,6 @@ feature &quot;Create an application&quot; do
55 54 expect(App.where(:name => 'My new app').count).to eq 1
56 55 expect(App.where(:name => 'My new app 2').count).to eq 0
57 56  
58   -
59 57 click_on I18n.t('shared.navigation.apps')
60 58 click_on 'My new app'
61 59 click_link I18n.t('apps.show.edit')
... ... @@ -64,7 +62,6 @@ feature &quot;Create an application&quot; do
64 62 page.has_content?(I18n.t('controllers.apps.flash.update.success'))
65 63 expect(App.where(:name => 'My new app').count).to eq 0
66 64 expect(App.where(:name => 'My new app 2').count).to eq 1
67   -
68 65 end
69 66  
70 67 scenario "create an apps with issue tracker and edit it", :js => true do
... ...
spec/acceptance/sign_in_with_github_spec.rb
1 1 require 'acceptance/acceptance_helper'
2 2  
3 3 feature 'Sign in with GitHub' do
4   -
5 4 background do
6 5 allow(Errbit::Config).to receive(:github_authentication).and_return(true)
7 6 Fabricate(:user, :github_login => 'nashby')
... ...
spec/controllers/api/v1/notices_controller_spec.rb
... ... @@ -28,14 +28,12 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
28 28 end
29 29  
30 30 describe "given a date range" do
31   -
32 31 it "should return only the notices created during the date range" do
33 32 get :index, {:auth_token => @user.authentication_token, :start_date => "2012-08-01", :end_date => "2012-08-27"}
34 33 expect(response).to be_success
35 34 notices = JSON.load response.body
36 35 expect(notices.length).to eq 3
37 36 end
38   -
39 37 end
40 38  
41 39 it "should return all notices" do
... ... @@ -44,7 +42,6 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
44 42 notices = JSON.load response.body
45 43 expect(notices.length).to eq 4
46 44 end
47   -
48 45 end
49 46 end
50 47 end
... ...
spec/controllers/apps_controller_spec.rb
... ... @@ -330,7 +330,6 @@ describe AppsController, type: &#39;controller&#39; do
330 330 end
331 331  
332 332 describe "POST /apps/:id/regenerate_api_key" do
333   -
334 333 context "like watcher" do
335 334 before do
336 335 sign_in watcher.user
... ... @@ -340,7 +339,6 @@ describe AppsController, type: &#39;controller&#39; do
340 339 post :regenerate_api_key, :id => 'foo'
341 340 expect(request).to redirect_to root_path
342 341 end
343   -
344 342 end
345 343  
346 344 context "like admin" do
... ...
spec/controllers/notices_controller_spec.rb
... ... @@ -34,7 +34,6 @@ describe NoticesController, type: &#39;controller&#39; do
34 34 expect(response.body).to match(%r{<id[^>]*>#{notice.id}</id>})
35 35 expect(response.body).to match(%r{<url[^>]*>(.+)#{locate_path(notice.id)}</url>})
36 36 end
37   -
38 37 end
39 38  
40 39 it "generates a notice from xml in a data param [POST]" do
... ...
spec/controllers/problems_controller_spec.rb
... ... @@ -318,7 +318,6 @@ describe ProblemsController, type: &#39;controller&#39; do
318 318 end
319 319  
320 320 context "POST /problems/unmerge_several" do
321   -
322 321 it "should require at least one problem" do
323 322 post :unmerge_several, :problems => []
324 323 expect(request.flash[:notice]).to eql I18n.t('controllers.problems.flash.no_select_problem')
... ... @@ -332,11 +331,9 @@ describe ProblemsController, type: &#39;controller&#39; do
332 331 expect(merged_problem.reload.errs.length).to eq 1
333 332 }.to change(Problem, :count).by(1)
334 333 end
335   -
336 334 end
337 335  
338 336 context "POST /problems/resolve_several" do
339   -
340 337 it "should require at least one problem" do
341 338 post :resolve_several, :problems => []
342 339 expect(request.flash[:notice]).to eql I18n.t('controllers.problems.flash.no_select_problem')
... ... @@ -360,7 +357,6 @@ describe ProblemsController, type: &#39;controller&#39; do
360 357 end
361 358  
362 359 context "POST /problems/unresolve_several" do
363   -
364 360 it "should require at least one problem" do
365 361 post :unresolve_several, :problems => []
366 362 expect(request.flash[:notice]).to eql I18n.t('controllers.problems.flash.no_select_problem')
... ...
spec/controllers/users_controller_spec.rb
... ... @@ -34,7 +34,6 @@ describe UsersController, type: &#39;controller&#39; do
34 34 expect(controller.user).to eq(user)
35 35 expect(response).to render_template 'edit'
36 36 end
37   -
38 37 end
39 38  
40 39 context "PUT /users/:other_id" do
... ... @@ -188,7 +187,6 @@ describe UsersController, type: &#39;controller&#39; do
188 187 end
189 188 end
190 189 context "when the update is unsuccessful" do
191   -
192 190 it "renders the edit page" do
193 191 put :update, :id => user.to_param, :user => {:name => nil}
194 192 expect(response).to render_template(:edit)
... ...
spec/decorators/issue_tracker_decorator_spec.rb
... ... @@ -3,6 +3,7 @@ describe IssueTrackerDecorator do
3 3 klass = Class.new(ErrbitPlugin::IssueTracker) {
4 4 def self.label; 'fake'; end
5 5 def self.note; 'a note'; end
  6 +
6 7 def self.fields
7 8 {
8 9 :foo => {:label => 'foo'},
... ...
spec/decorators/issue_tracker_type_decorator_spec.rb
... ... @@ -3,12 +3,14 @@ describe IssueTrackerDecorator do
3 3 klass = Class.new(ErrbitPlugin::IssueTracker) do
4 4 def self.label; 'fake'; end
5 5 def self.note; 'a note'; end
  6 +
6 7 def self.fields
7 8 {
8 9 :foo => {:label => 'foo'},
9 10 :bar => {:label => 'bar'}
10 11 }
11 12 end
  13 +
12 14 def self.icons
13 15 {
14 16 one: ['text/plain', 'all your base are belong to us'],
... ...
spec/fabricators/app_fabricator.rb
... ... @@ -12,7 +12,7 @@ end
12 12 Fabricator(:watcher) do
13 13 app
14 14 watcher_type 'email'
15   - email { sequence(:email){|n| "email#{n}@example.com"} }
  15 + email { sequence(:email){|n| "email#{n}@example.com"} }
16 16 end
17 17  
18 18 Fabricator(:user_watcher, :from => :watcher) do
... ...
spec/fabricators/comment_fabricator.rb
1 1 Fabricator :comment do
2 2 user
3   - body 'Test comment'
  3 + body 'Test comment'
4 4 err(:fabricator => :problem)
5 5 end
6 6  
... ...
spec/fabricators/notification_service_fabricator.rb
1   -Fabricator :notification_service do
  1 +Fabricator :notification_service do
2 2 app
3 3 room_id { sequence :word }
4 4 api_token { sequence :word }
... ...
spec/interactors/problem_destroy_spec.rb
... ... @@ -44,7 +44,6 @@ describe ProblemDestroy do
44 44 problem_destroy.execute
45 45 end
46 46 end
47   -
48 47 end
49 48  
50 49 context "in integration way" do
... ...
spec/mailers/mailer_spec.rb
... ... @@ -51,7 +51,7 @@ describe Mailer do
51 51 p.notices_count = 3
52 52 p
53 53 end
54   - let!(:user) { Fabricate(:admin) }
  54 + let!(:user) { Fabricate(:admin) }
55 55 let(:error_report) do
56 56 instance_double(
57 57 'ErrorReport',
... ...
spec/models/error_report_spec.rb
... ... @@ -292,7 +292,6 @@ describe ErrorReport do
292 292 it 'return the notice' do
293 293 expect(error_report.notice).to be_a Notice
294 294 end
295   -
296 295 end
297 296 end
298 297  
... ...
spec/models/notice_observer_spec.rb
... ... @@ -129,7 +129,6 @@ describe &quot;Callback on Notice&quot;, type: &#39;model&#39; do
129 129  
130 130 describe 'should not send a notification if a notification service is not' \
131 131 'configured' do
132   -
133 132 let(:notification_service) { Fabricate(:notification_service) }
134 133 let(:app) { Fabricate(:app, notification_service: notification_service )}
135 134 let(:notice_attrs) { notice_attrs_for.call(app.api_key) }
... ...
spec/models/notification_service/gtalk_service_spec.rb
... ... @@ -88,7 +88,6 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
88 88 @notification_service.room_id = ""
89 89 @notification_service.create_notification(@problem)
90 90 end
91   -
92 91 end
93 92  
94 93 it "it should send a notification to room only" do
... ...
spec/models/notification_service/notification_service_spec.rb
1 1 describe NotificationServices, type: 'model' do
2   -
3 2 let(:notice) { Fabricate :notice }
4 3 let(:notification_service) { Fabricate :notification_service, :app => notice.app }
5 4 let(:problem) { notice.problem }
... ...
spec/views/apps/new.html.haml_spec.rb
... ... @@ -18,7 +18,6 @@ describe &quot;apps/new.html.haml&quot;, type: &#39;view&#39; do
18 18  
19 19 expect(action_bar).to have_selector('a.button', :text => 'cancel')
20 20 end
21   -
22 21 end
23 22  
24 23 context "with unvalid app" do
... ...
spec/views/problems/show.html.haml_spec.rb
... ... @@ -104,7 +104,6 @@ describe &quot;problems/show.html.haml&quot;, type: &#39;view&#39; do
104 104 render
105 105 expect(view.content_for(:action_bar)).to_not match(/create issue/)
106 106 end
107   -
108 107 end
109 108  
110 109 context "with tracker associate on app" do
... ... @@ -138,7 +137,6 @@ describe &quot;problems/show.html.haml&quot;, type: &#39;view&#39; do
138 137 render
139 138 expect(view.content_for(:action_bar)).to match(/create issue/)
140 139 end
141   -
142 140 end
143 141  
144 142 context "with problem with issue link" do
... ...
spec/views/users/show.html.haml_spec.rb
... ... @@ -55,7 +55,6 @@ describe &#39;users/show.html.haml&#39;, type: &#39;view&#39; do
55 55 render
56 56 expect(view.content_for(:action_bar)).to have_selector('a.delete[data-confirm="%s"]' % I18n.t('.users.confirm_delete'))
57 57 end
58   -
59 58 end
60 59 end
61 60 end
... ...