Commit eb856246616e9c41ab430d73a0b91cea4c17b357

Authored by Laust Rud Jacobsen
1 parent 0149f833
Exists in master and in 1 other branch production

Rubocop: ensure a space is inside the braces of hash literals

.rubocop_todo.yml
@@ -295,12 +295,6 @@ Style/SpaceInsideBrackets: @@ -295,12 +295,6 @@ Style/SpaceInsideBrackets:
295 - 'spec/lib/configurator_spec.rb' 295 - 'spec/lib/configurator_spec.rb'
296 - 'spec/models/issue_spec.rb' 296 - 'spec/models/issue_spec.rb'
297 297
298 -# Offense count: 189  
299 -# Cop supports --auto-correct.  
300 -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.  
301 -Style/SpaceInsideHashLiteralBraces:  
302 - Enabled: false  
303 -  
304 # Offense count: 873 298 # Offense count: 873
305 # Cop supports --auto-correct. 299 # Cop supports --auto-correct.
306 # Configuration parameters: EnforcedStyle, SupportedStyles. 300 # Configuration parameters: EnforcedStyle, SupportedStyles.
app/controllers/api/v1/notices_controller.rb
@@ -8,7 +8,7 @@ class Api::V1::NoticesController < ApplicationController @@ -8,7 +8,7 @@ class Api::V1::NoticesController < ApplicationController
8 if params.key?(:start_date) && params.key?(:end_date) 8 if params.key?(:start_date) && params.key?(:end_date)
9 start_date = Time.zone.parse(params[:start_date]).utc 9 start_date = Time.zone.parse(params[:start_date]).utc
10 end_date = Time.zone.parse(params[:end_date]).utc 10 end_date = Time.zone.parse(params[:end_date]).utc
11 - query = {:created_at => {"$lte" => end_date, "$gte" => start_date}} 11 + query = { :created_at => { "$lte" => end_date, "$gte" => start_date } }
12 end 12 end
13 13
14 results = benchmark("[api/v1/notices_controller] query time") do 14 results = benchmark("[api/v1/notices_controller] query time") do
app/controllers/api/v1/problems_controller.rb
@@ -24,7 +24,7 @@ class Api::V1::ProblemsController < ApplicationController @@ -24,7 +24,7 @@ class Api::V1::ProblemsController < ApplicationController
24 if params.key?(:start_date) && params.key?(:end_date) 24 if params.key?(:start_date) && params.key?(:end_date)
25 start_date = Time.parse(params[:start_date]).utc 25 start_date = Time.parse(params[:start_date]).utc
26 end_date = Time.parse(params[:end_date]).utc 26 end_date = Time.parse(params[:end_date]).utc
27 - query = {:first_notice_at => {"$lte" => end_date}, "$or" => [{:resolved_at => nil}, {:resolved_at => {"$gte" => start_date}}]} 27 + query = { :first_notice_at => { "$lte" => end_date }, "$or" => [{ :resolved_at => nil }, { :resolved_at => { "$gte" => start_date } }] }
28 end 28 end
29 29
30 results = benchmark("[api/v1/problems_controller/index] query time") do 30 results = benchmark("[api/v1/problems_controller/index] query time") do
app/helpers/apps_helper.rb
@@ -5,8 +5,8 @@ module AppsHelper @@ -5,8 +5,8 @@ module AppsHelper
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 }. 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;"}) 8 + collect{|p| [ p.name, p.id ] }, { :include_blank => "[choose app]" },
  9 + { :class => "choose_other_app", :style => "display: none;" })
10 return html 10 return html
11 end 11 end
12 end 12 end
app/helpers/navigation_helper.rb
@@ -22,7 +22,7 @@ module NavigationHelper @@ -22,7 +22,7 @@ module NavigationHelper
22 matches.each {|c| s[c] = :all} 22 matches.each {|c| s[c] = :all}
23 s 23 s
24 else 24 else
25 - {matches => :all} 25 + { matches => :all }
26 end 26 end
27 27
28 active = nil 28 active = nil
app/models/notification_services/flowdock_service.rb
@@ -21,7 +21,7 @@ if defined? Flowdock @@ -21,7 +21,7 @@ if defined? Flowdock
21 end 21 end
22 22
23 def create_notification(problem) 23 def create_notification(problem)
24 - flow = Flowdock::Flow.new(:api_token => api_token, :source => "Errbit", :from => {:name => "Errbit", :address => ENV['ERRBIT_EMAIL_FROM'] || 'support@flowdock.com'}) 24 + flow = Flowdock::Flow.new(:api_token => api_token, :source => "Errbit", :from => { :name => "Errbit", :address => ENV['ERRBIT_EMAIL_FROM'] || 'support@flowdock.com' })
25 subject = "[#{problem.environment}] #{problem.message.to_s.truncate(100)}" 25 subject = "[#{problem.environment}] #{problem.message.to_s.truncate(100)}"
26 url = app_problem_url problem.app, problem 26 url = app_problem_url problem.app, problem
27 flow.push_to_team_inbox(:subject => subject, :content => content(problem, url), :project => project_name(problem), :link => url) 27 flow.push_to_team_inbox(:subject => subject, :content => content(problem, url), :project => project_name(problem), :link => url)
app/models/notification_services/hubot_service.rb
@@ -26,6 +26,6 @@ class NotificationServices::HubotService &lt; NotificationService @@ -26,6 +26,6 @@ class NotificationServices::HubotService &lt; NotificationService
26 end 26 end
27 27
28 def create_notification(problem) 28 def create_notification(problem)
29 - HTTParty.post(url, :body => {:message => message_for_hubot(problem), :room => room_id}) 29 + HTTParty.post(url, :body => { :message => message_for_hubot(problem), :room => room_id })
30 end 30 end
31 end 31 end
app/models/notification_services/webhook_service.rb
@@ -14,7 +14,7 @@ class NotificationServices::WebhookService &lt; NotificationService @@ -14,7 +14,7 @@ class NotificationServices::WebhookService &lt; NotificationService
14 end 14 end
15 15
16 def message_for_webhook(problem) 16 def message_for_webhook(problem)
17 - {:problem => {:url => problem_url(problem)}.merge(problem.as_json).to_json} 17 + { :problem => { :url => problem_url(problem) }.merge(problem.as_json).to_json }
18 end 18 end
19 19
20 def create_notification(problem) 20 def create_notification(problem)
app/models/problem.rb
@@ -139,7 +139,7 @@ class Problem @@ -139,7 +139,7 @@ class Problem
139 # find only notices related to this problem 139 # find only notices related to this problem
140 Notice.collection.find.aggregate([ 140 Notice.collection.find.aggregate([
141 { "$match" => { err_id: { "$in" => err_ids } } }, 141 { "$match" => { err_id: { "$in" => err_ids } } },
142 - { "$group" => { _id: "$#{v}", count: {"$sum" => 1} } } 142 + { "$group" => { _id: "$#{v}", count: { "$sum" => 1 } } }
143 ]).each do |agg| 143 ]).each do |agg|
144 send(k)[Digest::MD5.hexdigest(agg[:_id] || 'N/A')] = { 144 send(k)[Digest::MD5.hexdigest(agg[:_id] || 'N/A')] = {
145 'value' => agg[:_id] || 'N/A', 145 'value' => agg[:_id] || 'N/A',
@@ -194,7 +194,7 @@ class Problem @@ -194,7 +194,7 @@ class Problem
194 end 194 end
195 195
196 def unmerge! 196 def unmerge!
197 - attrs = {:error_class => error_class, :environment => environment} 197 + attrs = { :error_class => error_class, :environment => environment }
198 problem_errs = errs.to_a 198 problem_errs = errs.to_a
199 199
200 # associate and return all the problems 200 # associate and return all the problems
@@ -241,7 +241,7 @@ class Problem @@ -241,7 +241,7 @@ class Problem
241 end 241 end
242 242
243 def self.search(value) 243 def self.search(value)
244 - Problem.where({'$text' => {'$search' => value}}) 244 + Problem.where({ '$text' => { '$search' => value } })
245 end 245 end
246 246
247 private 247 private
lib/hoptoad/v2.rb
@@ -12,15 +12,15 @@ module Hoptoad @@ -12,15 +12,15 @@ module Hoptoad
12 case node 12 case node
13 when Hash 13 when Hash
14 if node.key?('var') && node.key?('key') 14 if node.key?('var') && node.key?('key')
15 - {normalize_key(node['key']) => rekey(node['var'])} 15 + { normalize_key(node['key']) => rekey(node['var']) }
16 elsif node.key?('var') 16 elsif node.key?('var')
17 rekey(node['var']) 17 rekey(node['var'])
18 elsif node.key?('__content__') && node.key?('key') 18 elsif node.key?('__content__') && node.key?('key')
19 - {normalize_key(node['key']) => rekey(node['__content__'])} 19 + { normalize_key(node['key']) => rekey(node['__content__']) }
20 elsif node.key?('__content__') 20 elsif node.key?('__content__')
21 rekey(node['__content__']) 21 rekey(node['__content__'])
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
lib/tasks/errbit/demo.rake
@@ -52,8 +52,8 @@ namespace :errbit do @@ -52,8 +52,8 @@ namespace :errbit do
52 'action' => 'error', 52 'action' => 'error',
53 'url' => "http://example.com/post/#{[111, 222, 333].sample}" 53 'url' => "http://example.com/post/#{[111, 222, 333].sample}"
54 }, 54 },
55 - :server_environment => {'environment-name' => Rails.env.to_s},  
56 - :notifier => {:name => "seeds.rb"}, 55 + :server_environment => { 'environment-name' => Rails.env.to_s },
  56 + :notifier => { :name => "seeds.rb" },
57 :app_user => { 57 :app_user => {
58 :id => "1234", 58 :id => "1234",
59 :username => "jsmith", 59 :username => "jsmith",
spec/controllers/api/v1/notices_controller_spec.rb
@@ -29,7 +29,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do @@ -29,7 +29,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
29 29
30 describe "given a date range" do 30 describe "given a date range" do
31 it "should return only the notices created during the date range" do 31 it "should return only the notices created during the date range" do
32 - get :index, {:auth_token => @user.authentication_token, :start_date => "2012-08-01", :end_date => "2012-08-27"} 32 + get :index, { :auth_token => @user.authentication_token, :start_date => "2012-08-01", :end_date => "2012-08-27" }
33 expect(response).to be_success 33 expect(response).to be_success
34 notices = JSON.load response.body 34 notices = JSON.load response.body
35 expect(notices.length).to eq 3 35 expect(notices.length).to eq 3
@@ -37,7 +37,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do @@ -37,7 +37,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
37 end 37 end
38 38
39 it "should return all notices" do 39 it "should return all notices" do
40 - get :index, {:auth_token => @user.authentication_token} 40 + get :index, { :auth_token => @user.authentication_token }
41 expect(response).to be_success 41 expect(response).to be_success
42 notices = JSON.load response.body 42 notices = JSON.load response.body
43 expect(notices.length).to eq 4 43 expect(notices.length).to eq 4
spec/controllers/api/v1/problems_controller_spec.rb
@@ -82,7 +82,7 @@ describe Api::V1::ProblemsController, type: &#39;controller&#39; do @@ -82,7 +82,7 @@ describe Api::V1::ProblemsController, type: &#39;controller&#39; do
82 82
83 describe "given a date range" do 83 describe "given a date range" do
84 it "should return only the problems open during the date range" do 84 it "should return only the problems open during the date range" do
85 - get :index, {:auth_token => @user.authentication_token, :start_date => "2012-08-20", :end_date => "2012-08-27"} 85 + get :index, { :auth_token => @user.authentication_token, :start_date => "2012-08-20", :end_date => "2012-08-27" }
86 expect(response).to be_success 86 expect(response).to be_success
87 problems = JSON.load response.body 87 problems = JSON.load response.body
88 expect(problems.length).to eq 2 88 expect(problems.length).to eq 2
@@ -90,7 +90,7 @@ describe Api::V1::ProblemsController, type: &#39;controller&#39; do @@ -90,7 +90,7 @@ describe Api::V1::ProblemsController, type: &#39;controller&#39; do
90 end 90 end
91 91
92 it "should return all problems" do 92 it "should return all problems" do
93 - get :index, {:auth_token => @user.authentication_token} 93 + get :index, { :auth_token => @user.authentication_token }
94 expect(response).to be_success 94 expect(response).to be_success
95 problems = JSON.load response.body 95 problems = JSON.load response.body
96 expect(problems.length).to eq 4 96 expect(problems.length).to eq 4
spec/controllers/apps_controller_spec.rb
1 describe AppsController, type: 'controller' do 1 describe AppsController, type: 'controller' do
2 it_requires_authentication 2 it_requires_authentication
3 - it_requires_admin_privileges :for => {:new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete} 3 + it_requires_admin_privileges :for => { :new => :get, :edit => :get, :create => :post, :update => :put, :destroy => :delete }
4 4
5 let(:admin) { Fabricate(:admin) } 5 let(:admin) { Fabricate(:admin) }
6 let(:user) { Fabricate(:user) } 6 let(:user) { Fabricate(:user) }
@@ -247,7 +247,7 @@ describe AppsController, type: &#39;controller&#39; do @@ -247,7 +247,7 @@ describe AppsController, type: &#39;controller&#39; do
247 context "changing name" do 247 context "changing name" do
248 it "should redirect to app page" do 248 it "should redirect to app page" do
249 id = @app.id 249 id = @app.id
250 - put :update, :id => id, :app => {:name => "new name"} 250 + put :update, :id => id, :app => { :name => "new name" }
251 expect(response).to redirect_to(app_path(id)) 251 expect(response).to redirect_to(app_path(id))
252 end 252 end
253 end 253 end
@@ -288,7 +288,7 @@ describe AppsController, type: &#39;controller&#39; do @@ -288,7 +288,7 @@ describe AppsController, type: &#39;controller&#39; do
288 context "unknown tracker type" do 288 context "unknown tracker type" do
289 before(:each) do 289 before(:each) do
290 put :update, :id => @app.id, :app => { :issue_tracker_attributes => { 290 put :update, :id => @app.id, :app => { :issue_tracker_attributes => {
291 - :type_tracker => 'unknown', :options => {:project_id => '1234', :api_token => '123123', :account => 'myapp'} 291 + :type_tracker => 'unknown', :options => { :project_id => '1234', :api_token => '123123', :account => 'myapp' }
292 } } 292 } }
293 @app.reload 293 @app.reload
294 end 294 end
spec/controllers/problems_controller_spec.rb
@@ -2,7 +2,7 @@ describe ProblemsController, type: &#39;controller&#39; do @@ -2,7 +2,7 @@ describe ProblemsController, type: &#39;controller&#39; do
2 it_requires_authentication :for => { 2 it_requires_authentication :for => {
3 :index => :get, :show => :get, :resolve => :put, :search => :get 3 :index => :get, :show => :get, :resolve => :put, :search => :get
4 }, 4 },
5 - :params => {:app_id => 'dummyid', :id => 'dummyid'} 5 + :params => { :app_id => 'dummyid', :id => 'dummyid' }
6 6
7 let(:app) { Fabricate(:app) } 7 let(:app) { Fabricate(:app) }
8 let(:err) { Fabricate(:err, :problem => problem) } 8 let(:err) { Fabricate(:err, :problem => problem) }
spec/controllers/users/omniauth_callbacks_controller_spec.rb
@@ -5,7 +5,7 @@ describe Users::OmniauthCallbacksController, type: &#39;controller&#39; do @@ -5,7 +5,7 @@ describe Users::OmniauthCallbacksController, type: &#39;controller&#39; do
5 env = { 5 env = {
6 "omniauth.auth" => Hashie::Mash.new( 6 "omniauth.auth" => Hashie::Mash.new(
7 :provider => 'github', 7 :provider => 'github',
8 - :extra => { :raw_info => { :login => login }}, 8 + :extra => { :raw_info => { :login => login } },
9 :credentials => { :token => token } 9 :credentials => { :token => token }
10 ) 10 )
11 } 11 }
spec/controllers/users_controller_spec.rb
@@ -46,47 +46,47 @@ describe UsersController, type: &#39;controller&#39; do @@ -46,47 +46,47 @@ describe UsersController, type: &#39;controller&#39; do
46 context "PUT /users/:my_id/id" do 46 context "PUT /users/:my_id/id" do
47 context "when the update is successful" do 47 context "when the update is successful" do
48 it "sets a message to display" do 48 it "sets a message to display" do
49 - put :update, :id => user.to_param, :user => {:name => 'Kermit'} 49 + put :update, :id => user.to_param, :user => { :name => 'Kermit' }
50 expect(request.flash[:success]).to include('updated') 50 expect(request.flash[:success]).to include('updated')
51 end 51 end
52 52
53 it "redirects to the user's page" do 53 it "redirects to the user's page" do
54 - put :update, :id => user.to_param, :user => {:name => 'Kermit'} 54 + put :update, :id => user.to_param, :user => { :name => 'Kermit' }
55 expect(response).to redirect_to(user_path(user)) 55 expect(response).to redirect_to(user_path(user))
56 end 56 end
57 57
58 it "should not be able to become an admin" do 58 it "should not be able to become an admin" do
59 expect { 59 expect {
60 - put :update, :id => user.to_param, :user => {:admin => true} 60 + put :update, :id => user.to_param, :user => { :admin => true }
61 }.to_not change { 61 }.to_not change {
62 user.reload.admin 62 user.reload.admin
63 }.from(false) 63 }.from(false)
64 end 64 end
65 65
66 it "should be able to set per_page option" do 66 it "should be able to set per_page option" do
67 - put :update, :id => user.to_param, :user => {:per_page => 555} 67 + put :update, :id => user.to_param, :user => { :per_page => 555 }
68 expect(user.reload.per_page).to eq 555 68 expect(user.reload.per_page).to eq 555
69 end 69 end
70 70
71 it "should be able to set time_zone option" do 71 it "should be able to set time_zone option" do
72 - put :update, :id => user.to_param, :user => {:time_zone => "Warsaw"} 72 + put :update, :id => user.to_param, :user => { :time_zone => "Warsaw" }
73 expect(user.reload.time_zone).to eq "Warsaw" 73 expect(user.reload.time_zone).to eq "Warsaw"
74 end 74 end
75 75
76 it "should be able to not set github_login option" do 76 it "should be able to not set github_login option" do
77 - put :update, :id => user.to_param, :user => {:github_login => " "} 77 + put :update, :id => user.to_param, :user => { :github_login => " " }
78 expect(user.reload.github_login).to eq nil 78 expect(user.reload.github_login).to eq nil
79 end 79 end
80 80
81 it "should be able to set github_login option" do 81 it "should be able to set github_login option" do
82 - put :update, :id => user.to_param, :user => {:github_login => "awesome_name"} 82 + put :update, :id => user.to_param, :user => { :github_login => "awesome_name" }
83 expect(user.reload.github_login).to eq "awesome_name" 83 expect(user.reload.github_login).to eq "awesome_name"
84 end 84 end
85 end 85 end
86 86
87 context "when the update is unsuccessful" do 87 context "when the update is unsuccessful" do
88 it "renders the edit page" do 88 it "renders the edit page" do
89 - put :update, :id => user.to_param, :user => {:name => nil} 89 + put :update, :id => user.to_param, :user => { :name => nil }
90 expect(response).to render_template(:edit) 90 expect(response).to render_template(:edit)
91 end 91 end
92 end 92 end
@@ -131,7 +131,7 @@ describe UsersController, type: &#39;controller&#39; do @@ -131,7 +131,7 @@ describe UsersController, type: &#39;controller&#39; do
131 131
132 context "POST /users" do 132 context "POST /users" do
133 context "when the create is successful" do 133 context "when the create is successful" do
134 - let(:attrs) { {:user => Fabricate.to_params(:user)} } 134 + let(:attrs) { { :user => Fabricate.to_params(:user) } }
135 135
136 it "sets a message to display" do 136 it "sets a message to display" do
137 post :create, attrs 137 post :create, attrs
@@ -179,7 +179,7 @@ describe UsersController, type: &#39;controller&#39; do @@ -179,7 +179,7 @@ describe UsersController, type: &#39;controller&#39; do
179 } 179 }
180 180
181 context "with normal params" do 181 context "with normal params" do
182 - let(:user_params) { {:name => 'Kermit'} } 182 + let(:user_params) { { :name => 'Kermit' } }
183 it "sets a message to display" do 183 it "sets a message to display" do
184 expect(request.flash[:success]).to eq I18n.t('controllers.users.flash.update.success', :name => user.reload.name) 184 expect(request.flash[:success]).to eq I18n.t('controllers.users.flash.update.success', :name => user.reload.name)
185 expect(response).to redirect_to(user_path(user)) 185 expect(response).to redirect_to(user_path(user))
@@ -188,7 +188,7 @@ describe UsersController, type: &#39;controller&#39; do @@ -188,7 +188,7 @@ describe UsersController, type: &#39;controller&#39; do
188 end 188 end
189 context "when the update is unsuccessful" do 189 context "when the update is unsuccessful" do
190 it "renders the edit page" do 190 it "renders the edit page" do
191 - put :update, :id => user.to_param, :user => {:name => nil} 191 + put :update, :id => user.to_param, :user => { :name => nil }
192 expect(response).to render_template(:edit) 192 expect(response).to render_template(:edit)
193 end 193 end
194 end 194 end
@@ -230,14 +230,14 @@ describe UsersController, type: &#39;controller&#39; do @@ -230,14 +230,14 @@ describe UsersController, type: &#39;controller&#39; do
230 ActionController::Parameters.new(user_param) 230 ActionController::Parameters.new(user_param)
231 ) 231 )
232 } 232 }
233 - let(:user_param) { {'user' => { :name => 'foo', :admin => true }} } 233 + let(:user_param) { { 'user' => { :name => 'foo', :admin => true } } }
234 it 'not have admin field' do 234 it 'not have admin field' do
235 - expect(controller.send(:user_params)).to eq({'name' => 'foo'}) 235 + expect(controller.send(:user_params)).to eq({ 'name' => 'foo' })
236 end 236 end
237 context "with password and password_confirmation empty?" do 237 context "with password and password_confirmation empty?" do
238 - let(:user_param) { {'user' => { :name => 'foo', 'password' => '', 'password_confirmation' => '' }} } 238 + let(:user_param) { { 'user' => { :name => 'foo', 'password' => '', 'password_confirmation' => '' } } }
239 it 'not have password and password_confirmation field' do 239 it 'not have password and password_confirmation field' do
240 - expect(controller.send(:user_params)).to eq({'name' => 'foo'}) 240 + expect(controller.send(:user_params)).to eq({ 'name' => 'foo' })
241 end 241 end
242 end 242 end
243 end 243 end
spec/decorators/issue_tracker_decorator_spec.rb
@@ -11,8 +11,8 @@ describe IssueTrackerDecorator do @@ -11,8 +11,8 @@ describe IssueTrackerDecorator do
11 11
12 def self.fields 12 def self.fields
13 { 13 {
14 - :foo => {:label => 'foo'},  
15 - :bar => {:label => 'bar'} 14 + :foo => { :label => 'foo' },
  15 + :bar => { :label => 'bar' }
16 } 16 }
17 end 17 end
18 18
spec/decorators/issue_tracker_field_decorator.rb
1 describe IssueTrackerFieldDecorator do 1 describe IssueTrackerFieldDecorator do
2 describe "#label" do 2 describe "#label" do
3 it 'return the label of field_info by default' do 3 it 'return the label of field_info by default' do
4 - expect(IssueTrackerFieldDecorator.new(:foo, {:label => 'hello'}).label).to eq 'hello' 4 + expect(IssueTrackerFieldDecorator.new(:foo, { :label => 'hello' }).label).to eq 'hello'
5 end 5 end
6 6
7 it 'return the key of field if no label define' do 7 it 'return the key of field if no label define' do
spec/decorators/issue_tracker_type_decorator_spec.rb
@@ -11,8 +11,8 @@ describe IssueTrackerDecorator do @@ -11,8 +11,8 @@ describe IssueTrackerDecorator do
11 11
12 def self.fields 12 def self.fields
13 { 13 {
14 - :foo => {:label => 'foo'},  
15 - :bar => {:label => 'bar'} 14 + :foo => { :label => 'foo' },
  15 + :bar => { :label => 'bar' }
16 } 16 }
17 end 17 end
18 18
@@ -45,7 +45,7 @@ describe IssueTrackerDecorator do @@ -45,7 +45,7 @@ describe IssueTrackerDecorator do
45 decorator.fields do |itf| 45 decorator.fields do |itf|
46 expect(itf).to be_a(IssueTrackerFieldDecorator) 46 expect(itf).to be_a(IssueTrackerFieldDecorator)
47 expect([:foo, :bar]).to be_include(itf.object) 47 expect([:foo, :bar]).to be_include(itf.object)
48 - expect([{:label => 'foo'}, {:label => 'bar'}]).to be_include(itf.field_info) 48 + expect([{ :label => 'foo' }, { :label => 'bar' }]).to be_include(itf.field_info)
49 end 49 end
50 end 50 end
51 end 51 end
spec/errbit_plugin/mock_issue_tracker.rb
@@ -10,8 +10,8 @@ module ErrbitPlugin @@ -10,8 +10,8 @@ module ErrbitPlugin
10 10
11 def self.fields 11 def self.fields
12 { 12 {
13 - :foo => {:label => 'foo'},  
14 - :bar => {:label => 'bar'} 13 + :foo => { :label => 'foo' },
  14 + :bar => { :label => 'bar' }
15 } 15 }
16 end 16 end
17 17
spec/interactors/problem_destroy_spec.rb
@@ -40,7 +40,7 @@ describe ProblemDestroy do @@ -40,7 +40,7 @@ describe ProblemDestroy do
40 end 40 end
41 41
42 it 'delete all notice of associate to this errs' do 42 it 'delete all notice of associate to this errs' do
43 - expect(Notice).to receive(:delete_all).with({:err_id => { '$in' => [err_1.id, err_2.id] }}) 43 + expect(Notice).to receive(:delete_all).with({ :err_id => { '$in' => [err_1.id, err_2.id] } })
44 problem_destroy.execute 44 problem_destroy.execute
45 end 45 end
46 end 46 end
spec/interactors/resolved_problem_clearer_spec.rb
@@ -20,7 +20,7 @@ describe ResolvedProblemClearer do @@ -20,7 +20,7 @@ describe ResolvedProblemClearer do
20 end 20 end
21 it 'not repair database' do 21 it 'not repair database' do
22 allow(Mongoid.default_client).to receive(:command).and_call_original 22 allow(Mongoid.default_client).to receive(:command).and_call_original
23 - expect(Mongoid.default_client).to_not receive(:command).with({:repairDatabase => 1}) 23 + expect(Mongoid.default_client).to_not receive(:command).with({ :repairDatabase => 1 })
24 resolved_problem_clearer.execute 24 resolved_problem_clearer.execute
25 end 25 end
26 end 26 end
@@ -28,7 +28,7 @@ describe ResolvedProblemClearer do @@ -28,7 +28,7 @@ describe ResolvedProblemClearer do
28 context "with problem resolve" do 28 context "with problem resolve" do
29 before do 29 before do
30 allow(Mongoid.default_client).to receive(:command).and_call_original 30 allow(Mongoid.default_client).to receive(:command).and_call_original
31 - allow(Mongoid.default_client).to receive(:command).with({:repairDatabase => 1}) 31 + allow(Mongoid.default_client).to receive(:command).with({ :repairDatabase => 1 })
32 problems.first.resolve! 32 problems.first.resolve!
33 problems.second.resolve! 33 problems.second.resolve!
34 end 34 end
@@ -44,7 +44,7 @@ describe ResolvedProblemClearer do @@ -44,7 +44,7 @@ describe ResolvedProblemClearer do
44 end 44 end
45 45
46 it 'repair database' do 46 it 'repair database' do
47 - expect(Mongoid.default_client).to receive(:command).with({:repairDatabase => 1}) 47 + expect(Mongoid.default_client).to receive(:command).with({ :repairDatabase => 1 })
48 resolved_problem_clearer.execute 48 resolved_problem_clearer.execute
49 end 49 end
50 end 50 end
spec/lib/airbrake_api/v3/notice_parser_spec.rb
@@ -7,7 +7,7 @@ describe AirbrakeApi::V3::NoticeParser do @@ -7,7 +7,7 @@ describe AirbrakeApi::V3::NoticeParser do
7 }.to raise_error(AirbrakeApi::ParamsError) 7 }.to raise_error(AirbrakeApi::ParamsError)
8 8
9 expect { 9 expect {
10 - AirbrakeApi::V3::NoticeParser.new({'errors' => []}).report 10 + AirbrakeApi::V3::NoticeParser.new({ 'errors' => [] }).report
11 }.to raise_error(AirbrakeApi::ParamsError) 11 }.to raise_error(AirbrakeApi::ParamsError)
12 end 12 end
13 13
@@ -20,7 +20,7 @@ describe AirbrakeApi::V3::NoticeParser do @@ -20,7 +20,7 @@ describe AirbrakeApi::V3::NoticeParser do
20 expect(report.error_class).to eq('Error') 20 expect(report.error_class).to eq('Error')
21 expect(report.message).to eq('Error: TestError') 21 expect(report.message).to eq('Error: TestError')
22 expect(report.backtrace.lines.size).to eq(9) 22 expect(report.backtrace.lines.size).to eq(9)
23 - expect(notice.user_attributes).to include({'Id' => 1, 'Name' => 'John Doe', 'Email' => 'john.doe@example.org', 'Username' => 'john'}) 23 + expect(notice.user_attributes).to include({ 'Id' => 1, 'Name' => 'John Doe', 'Email' => 'john.doe@example.org', 'Username' => 'john' })
24 expect(notice.session).to include('isAdmin' => true) 24 expect(notice.session).to include('isAdmin' => true)
25 expect(notice.params).to include('returnTo' => 'dashboard') 25 expect(notice.params).to include('returnTo' => 'dashboard')
26 expect(notice.env_vars).to include( 26 expect(notice.env_vars).to include(
spec/models/notice_spec.rb
@@ -21,8 +21,8 @@ describe Notice, type: &#39;model&#39; do @@ -21,8 +21,8 @@ describe Notice, type: &#39;model&#39; do
21 21
22 describe "key sanitization" do 22 describe "key sanitization" do
23 before do 23 before do
24 - @hash = { "some.key" => { "$nested.key" => {"$Path" => "/", "some$key" => "key"}}}  
25 - @hash_sanitized = { "some&#46;key" => { "&#36;nested&#46;key" => {"&#36;Path" => "/", "some$key" => "key"}}} 24 + @hash = { "some.key" => { "$nested.key" => { "$Path" => "/", "some$key" => "key" } } }
  25 + @hash_sanitized = { "some&#46;key" => { "&#36;nested&#46;key" => { "&#36;Path" => "/", "some$key" => "key" } } }
26 end 26 end
27 [:server_environment, :request, :notifier].each do |key| 27 [:server_environment, :request, :notifier].each do |key|
28 it "replaces . with &#46; and $ with &#36; in keys used in #{key}" do 28 it "replaces . with &#46; and $ with &#36; in keys used in #{key}" do
@@ -37,7 +37,7 @@ describe Notice, type: &#39;model&#39; do @@ -37,7 +37,7 @@ describe Notice, type: &#39;model&#39; do
37 let(:notice) { Fabricate.build(:notice, request: request) } 37 let(:notice) { Fabricate.build(:notice, request: request) }
38 38
39 context "when it has a request url" do 39 context "when it has a request url" do
40 - let(:request) { {'url' => "http://example.com/resource/12", 'cgi-data' => {'HTTP_USER_AGENT' => 'Mozilla/5.0'}} } 40 + let(:request) { { 'url' => "http://example.com/resource/12", 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0' } } }
41 41
42 it 'has a curl representation' do 42 it 'has a curl representation' do
43 cmd = notice.to_curl 43 cmd = notice.to_curl
@@ -46,7 +46,7 @@ describe Notice, type: &#39;model&#39; do @@ -46,7 +46,7 @@ describe Notice, type: &#39;model&#39; do
46 end 46 end
47 47
48 context "when it has not a request url" do 48 context "when it has not a request url" do
49 - let(:request) { {'cgi-data' => {'HTTP_USER_AGENT' => 'Mozilla/5.0'}} } 49 + let(:request) { { 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0' } } }
50 50
51 it 'has a curl representation' do 51 it 'has a curl representation' do
52 cmd = notice.to_curl 52 cmd = notice.to_curl
@@ -57,9 +57,9 @@ describe Notice, type: &#39;model&#39; do @@ -57,9 +57,9 @@ describe Notice, type: &#39;model&#39; do
57 57
58 describe "user agent" do 58 describe "user agent" do
59 it "should be parsed and human-readable" do 59 it "should be parsed and human-readable" do
60 - notice = Fabricate.build(:notice, :request => {'cgi-data' => { 60 + notice = Fabricate.build(:notice, :request => { 'cgi-data' => {
61 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16' 61 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16'
62 - }}) 62 + } })
63 expect(notice.user_agent.browser).to eq 'Chrome' 63 expect(notice.user_agent.browser).to eq 'Chrome'
64 expect(notice.user_agent.version.to_s).to match(/^10\.0/) 64 expect(notice.user_agent.version.to_s).to match(/^10\.0/)
65 end 65 end
@@ -72,7 +72,7 @@ describe Notice, type: &#39;model&#39; do @@ -72,7 +72,7 @@ describe Notice, type: &#39;model&#39; do
72 72
73 describe "user agent string" do 73 describe "user agent string" do
74 it "should be parsed and human-readable" do 74 it "should be parsed and human-readable" do
75 - notice = Fabricate.build(:notice, :request => {'cgi-data' => {'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16'}}) 75 + notice = Fabricate.build(:notice, :request => { 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16' } })
76 expect(notice.user_agent_string).to eq 'Chrome 10.0.648.204 (OS X 10.6.7)' 76 expect(notice.user_agent_string).to eq 'Chrome 10.0.648.204 (OS X 10.6.7)'
77 end 77 end
78 78
@@ -84,17 +84,17 @@ describe Notice, type: &#39;model&#39; do @@ -84,17 +84,17 @@ describe Notice, type: &#39;model&#39; do
84 84
85 describe "host" do 85 describe "host" do
86 it "returns host if url is valid" do 86 it "returns host if url is valid" do
87 - notice = Fabricate.build(:notice, :request => {'url' => "http://example.com/resource/12"}) 87 + notice = Fabricate.build(:notice, :request => { 'url' => "http://example.com/resource/12" })
88 expect(notice.host).to eq 'example.com' 88 expect(notice.host).to eq 'example.com'
89 end 89 end
90 90
91 it "returns 'N/A' when url is not valid" do 91 it "returns 'N/A' when url is not valid" do
92 - notice = Fabricate.build(:notice, :request => {'url' => "file:///path/to/some/resource/12"}) 92 + notice = Fabricate.build(:notice, :request => { 'url' => "file:///path/to/some/resource/12" })
93 expect(notice.host).to eq 'N/A' 93 expect(notice.host).to eq 'N/A'
94 end 94 end
95 95
96 it "returns 'N/A' when url is not valid" do 96 it "returns 'N/A' when url is not valid" do
97 - notice = Fabricate.build(:notice, :request => {'url' => "some string"}) 97 + notice = Fabricate.build(:notice, :request => { 'url' => "some string" })
98 expect(notice.host).to eq 'N/A' 98 expect(notice.host).to eq 'N/A'
99 end 99 end
100 100
spec/models/notification_service/hubot_service_spec.rb
@@ -6,7 +6,7 @@ describe NotificationServices::HubotService, type: &#39;model&#39; do @@ -6,7 +6,7 @@ describe NotificationServices::HubotService, type: &#39;model&#39; do
6 problem = notice.problem 6 problem = notice.problem
7 7
8 # faraday stubbing 8 # faraday stubbing
9 - expect(HTTParty).to receive(:post).with(notification_service.api_token, :body => {:message => an_instance_of(String), :room => notification_service.room_id}).and_return(true) 9 + expect(HTTParty).to receive(:post).with(notification_service.api_token, :body => { :message => an_instance_of(String), :room => notification_service.room_id }).and_return(true)
10 10
11 notification_service.create_notification(problem) 11 notification_service.create_notification(problem)
12 end 12 end
spec/models/notification_service/slack_service_spec.rb
@@ -47,7 +47,7 @@ describe NotificationServices::SlackService, type: &#39;model&#39; do @@ -47,7 +47,7 @@ describe NotificationServices::SlackService, type: &#39;model&#39; do
47 } 47 }
48 ] 48 ]
49 }.to_json 49 }.to_json
50 - expect(HTTParty).to receive(:post).with(notification_service.service_url, :body => payload, :headers => {"Content-Type" => "application/json"}).and_return(true) 50 + expect(HTTParty).to receive(:post).with(notification_service.service_url, :body => payload, :headers => { "Content-Type" => "application/json" }).and_return(true)
51 51
52 notification_service.create_notification(problem) 52 notification_service.create_notification(problem)
53 end 53 end
spec/models/problem_spec.rb
@@ -273,7 +273,7 @@ describe Problem, type: &#39;model&#39; do @@ -273,7 +273,7 @@ describe Problem, type: &#39;model&#39; do
273 expect { 273 expect {
274 @err.notices.first.destroy 274 @err.notices.first.destroy
275 @problem.reload 275 @problem.reload
276 - }.to change(@problem, :messages).from({Digest::MD5.hexdigest('ERR 1') => {'value' => 'ERR 1', 'count' => 1}}).to({}) 276 + }.to change(@problem, :messages).from({ Digest::MD5.hexdigest('ERR 1') => { 'value' => 'ERR 1', 'count' => 1 } }).to({})
277 end 277 end
278 278
279 it "removing a notice from the problem with broken counter should not raise an error" do 279 it "removing a notice from the problem with broken counter should not raise an error" do
@@ -296,11 +296,11 @@ describe Problem, type: &#39;model&#39; do @@ -296,11 +296,11 @@ describe Problem, type: &#39;model&#39; do
296 end 296 end
297 297
298 it "removing a notice removes string from #hosts" do 298 it "removing a notice removes string from #hosts" do
299 - Fabricate(:notice, :err => @err, :request => {'url' => "http://example.com/resource/12"}) 299 + Fabricate(:notice, :err => @err, :request => { 'url' => "http://example.com/resource/12" })
300 expect { 300 expect {
301 @err.notices.first.destroy 301 @err.notices.first.destroy
302 @problem.reload 302 @problem.reload
303 - }.to change(@problem, :hosts).from({Digest::MD5.hexdigest('example.com') => {'value' => 'example.com', 'count' => 1}}).to({}) 303 + }.to change(@problem, :hosts).from({ Digest::MD5.hexdigest('example.com') => { 'value' => 'example.com', 'count' => 1 } }).to({})
304 end 304 end
305 end 305 end
306 306
@@ -316,12 +316,12 @@ describe Problem, type: &#39;model&#39; do @@ -316,12 +316,12 @@ describe Problem, type: &#39;model&#39; do
316 end 316 end
317 317
318 it "removing a notice removes string from #user_agents" do 318 it "removing a notice removes string from #user_agents" do
319 - Fabricate(:notice, :err => @err, :request => {'cgi-data' => {'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16'}}) 319 + Fabricate(:notice, :err => @err, :request => { 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16' } })
320 expect { 320 expect {
321 @err.notices.first.destroy 321 @err.notices.first.destroy
322 @problem.reload 322 @problem.reload
323 }.to change(@problem, :user_agents).from({ 323 }.to change(@problem, :user_agents).from({
324 - Digest::MD5.hexdigest('Chrome 10.0.648.204 (OS X 10.6.7)') => {'value' => 'Chrome 10.0.648.204 (OS X 10.6.7)', 'count' => 1} 324 + Digest::MD5.hexdigest('Chrome 10.0.648.204 (OS X 10.6.7)') => { 'value' => 'Chrome 10.0.648.204 (OS X 10.6.7)', 'count' => 1 }
325 }).to({}) 325 }).to({})
326 end 326 end
327 end 327 end
@@ -438,19 +438,19 @@ describe Problem, type: &#39;model&#39; do @@ -438,19 +438,19 @@ describe Problem, type: &#39;model&#39; do
438 438
439 it 'update stats messages' do 439 it 'update stats messages' do
440 expect(problem.messages).to eq({ 440 expect(problem.messages).to eq({
441 - Digest::MD5.hexdigest(notice.message) => {'value' => notice.message, 'count' => 1} 441 + Digest::MD5.hexdigest(notice.message) => { 'value' => notice.message, 'count' => 1 }
442 }) 442 })
443 end 443 end
444 444
445 it 'update stats hosts' do 445 it 'update stats hosts' do
446 expect(problem.hosts).to eq({ 446 expect(problem.hosts).to eq({
447 - Digest::MD5.hexdigest(notice.host) => {'value' => notice.host, 'count' => 1} 447 + Digest::MD5.hexdigest(notice.host) => { 'value' => notice.host, 'count' => 1 }
448 }) 448 })
449 end 449 end
450 450
451 it 'update stats user_agents' do 451 it 'update stats user_agents' do
452 expect(problem.user_agents).to eq({ 452 expect(problem.user_agents).to eq({
453 - Digest::MD5.hexdigest(notice.user_agent_string) => {'value' => notice.user_agent_string, 'count' => 1} 453 + Digest::MD5.hexdigest(notice.user_agent_string) => { 'value' => notice.user_agent_string, 'count' => 1 }
454 }) 454 })
455 end 455 end
456 end 456 end
@@ -478,19 +478,19 @@ describe Problem, type: &#39;model&#39; do @@ -478,19 +478,19 @@ describe Problem, type: &#39;model&#39; do
478 478
479 it 'update stats messages' do 479 it 'update stats messages' do
480 expect(problem.messages).to eq({ 480 expect(problem.messages).to eq({
481 - Digest::MD5.hexdigest(notice.message) => {'value' => notice.message, 'count' => 3} 481 + Digest::MD5.hexdigest(notice.message) => { 'value' => notice.message, 'count' => 3 }
482 }) 482 })
483 end 483 end
484 484
485 it 'update stats hosts' do 485 it 'update stats hosts' do
486 expect(problem.hosts).to eq({ 486 expect(problem.hosts).to eq({
487 - Digest::MD5.hexdigest(notice.host) => {'value' => notice.host, 'count' => 3} 487 + Digest::MD5.hexdigest(notice.host) => { 'value' => notice.host, 'count' => 3 }
488 }) 488 })
489 end 489 end
490 490
491 it 'update stats user_agents' do 491 it 'update stats user_agents' do
492 expect(problem.user_agents).to eq({ 492 expect(problem.user_agents).to eq({
493 - Digest::MD5.hexdigest(notice.user_agent_string) => {'value' => notice.user_agent_string, 'count' => 3} 493 + Digest::MD5.hexdigest(notice.user_agent_string) => { 'value' => notice.user_agent_string, 'count' => 3 }
494 }) 494 })
495 end 495 end
496 end 496 end
spec/support/macros.rb
@@ -9,7 +9,7 @@ def it_requires_authentication(options = {}) @@ -9,7 +9,7 @@ def it_requires_authentication(options = {})
9 :update => :put, 9 :update => :put,
10 :destroy => :delete 10 :destroy => :delete
11 }, 11 },
12 - :params => {:id => '4c6c760494df2a18cc000015'} 12 + :params => { :id => '4c6c760494df2a18cc000015' }
13 } 13 }
14 options.reverse_merge!(default_options) 14 options.reverse_merge!(default_options)
15 15
@@ -38,7 +38,7 @@ def it_requires_admin_privileges(options = {}) @@ -38,7 +38,7 @@ def it_requires_admin_privileges(options = {})
38 :update => :put, 38 :update => :put,
39 :destroy => :delete 39 :destroy => :delete
40 }, 40 },
41 - :params => {:id => 'dummyid'} 41 + :params => { :id => 'dummyid' }
42 } 42 }
43 options.reverse_merge!(default_options) 43 options.reverse_merge!(default_options)
44 44
spec/views/notices/_user_attributes.html.haml_spec.rb
1 describe "notices/_user_attributes.html.haml", type: 'view' do 1 describe "notices/_user_attributes.html.haml", type: 'view' do
2 describe 'autolink' do 2 describe 'autolink' do
3 let(:notice) do 3 let(:notice) do
4 - user_attributes = { 'foo' => {'bar' => 'http://example.com'} } 4 + user_attributes = { 'foo' => { 'bar' => 'http://example.com' } }
5 Fabricate(:notice, :user_attributes => user_attributes) 5 Fabricate(:notice, :user_attributes => user_attributes)
6 end 6 end
7 7