Commit 7dc461eed78b12a0090c7cd57b6c5ec486b56722

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

Rubocop: remove unnecessary braces around parameters

.rubocop_todo.yml
... ... @@ -59,12 +59,6 @@ Rails/Validation:
59 59 Style/BlockDelimiters:
60 60 Enabled: false
61 61  
62   -# Offense count: 49
63   -# Cop supports --auto-correct.
64   -# Configuration parameters: EnforcedStyle, SupportedStyles.
65   -Style/BracesAroundHashParameters:
66   - Enabled: false
67   -
68 62 # Offense count: 15
69 63 # Configuration parameters: EnforcedStyle, SupportedStyles.
70 64 Style/ClassAndModuleChildren:
... ...
app/helpers/apps_helper.rb
... ... @@ -6,7 +6,7 @@ module AppsHelper
6 6 html << select("duplicate", "app",
7 7 App.all.asc(:name).reject { |a| a == @app }.
8 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 10 return html
11 11 end
12 12 end
... ...
app/models/backtrace.rb
... ... @@ -15,7 +15,7 @@ class Backtrace
15 15  
16 16 where(fingerprint: fingerprint).find_one_and_update(
17 17 { '$setOnInsert' => { fingerprint: fingerprint, lines: lines } },
18   - { return_document: :after, upsert: true })
  18 + return_document: :after, upsert: true)
19 19 end
20 20  
21 21 def self.generate_fingerprint(lines)
... ...
app/models/problem.rb
... ... @@ -241,7 +241,7 @@ class Problem
241 241 end
242 242  
243 243 def self.search(value)
244   - Problem.where({ '$text' => { '$search' => value } })
  244 + Problem.where('$text' => { '$search' => value })
245 245 end
246 246  
247 247 private
... ...
config/load.rb
... ... @@ -7,7 +7,7 @@ require_relative &#39;../lib/configurator&#39;
7 7 #
8 8 # We use the first non-nil environment variable in the list. If the last array
9 9 # element is a proc, it runs at the end, overriding the config value
10   -Errbit::Config = Configurator.run({
  10 +Errbit::Config = Configurator.run(
11 11 host: ['ERRBIT_HOST'],
12 12 protocol: ['ERRBIT_PROTOCOL'],
13 13 port: ['ERRBIT_PORT'],
... ... @@ -60,4 +60,4 @@ Errbit::Config = Configurator.run({
60 60 sendmail_arguments: ['SENDMAIL_ARGUMENTS'],
61 61  
62 62 devise_modules: ['DEVISE_MODULES']
63   -})
  63 +)
... ...
config/mongo.rb
... ... @@ -10,7 +10,7 @@ Mongoid.configure do |config|
10 10 Errbit::Config.mongo_url
11 11 end
12 12  
13   - config.load_configuration({
  13 + config.load_configuration(
14 14 clients: {
15 15 default: {
16 16 uri: uri
... ... @@ -19,5 +19,5 @@ Mongoid.configure do |config|
19 19 options: {
20 20 use_activesupport_time_zone: true
21 21 }
22   - })
  22 + )
23 23 end
... ...
db/migrate/201510290041_extract_issue_tracker.rb
... ... @@ -34,9 +34,7 @@ class ExtractIssueTracker &lt; Mongoid::Migration
34 34 'created_at' => created_at
35 35 }
36 36  
37   - App.where({ _id: app.id }).update({
38   - "$set" => { issue_tracker: tracker }
39   - })
  37 + App.where(_id: app.id).update("$set" => { issue_tracker: tracker })
40 38 end
41 39 end
42 40  
... ...
lib/tasks/errbit/demo.rake
... ... @@ -43,25 +43,27 @@ namespace :errbit do
43 43  
44 44 errors.each do |error_template|
45 45 rand(34).times do
46   - ErrorReport.new(error_template.reverse_merge({
47   - api_key: app.api_key,
48   - error_class: "StandardError",
49   - message: "Oops. Something went wrong!",
50   - backtrace: random_backtrace,
51   - request: {
52   - 'component' => 'main',
53   - 'action' => 'error',
54   - 'url' => "http://example.com/post/#{[111, 222, 333].sample}"
55   - },
56   - server_environment: { 'environment-name' => Rails.env.to_s },
57   - notifier: { name: "seeds.rb" },
58   - app_user: {
59   - id: "1234",
60   - username: "jsmith",
61   - name: "John Smith",
62   - url: "http://www.example.com/users/jsmith"
63   - }
64   - })).generate_notice!
  46 + ErrorReport.new(
  47 + error_template.reverse_merge(
  48 + api_key: app.api_key,
  49 + error_class: "StandardError",
  50 + message: "Oops. Something went wrong!",
  51 + backtrace: random_backtrace,
  52 + request: {
  53 + 'component' => 'main',
  54 + 'action' => 'error',
  55 + 'url' => "http://example.com/post/#{[111, 222, 333].sample}"
  56 + },
  57 + server_environment: { 'environment-name' => Rails.env.to_s },
  58 + notifier: { name: "seeds.rb" },
  59 + app_user: {
  60 + id: "1234",
  61 + username: "jsmith",
  62 + name: "John Smith",
  63 + url: "http://www.example.com/users/jsmith"
  64 + }
  65 + )
  66 + ).generate_notice!
65 67 end
66 68 end
67 69  
... ...
spec/controllers/api/v1/notices_controller_spec.rb
... ... @@ -29,7 +29,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
29 29  
30 30 describe "given a date range" do
31 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 33 expect(response).to be_success
34 34 notices = JSON.load response.body
35 35 expect(notices.length).to eq 3
... ... @@ -37,7 +37,7 @@ describe Api::V1::NoticesController, type: &#39;controller&#39; do
37 37 end
38 38  
39 39 it "should return all notices" do
40   - get :index, { auth_token: @user.authentication_token }
  40 + get :index, auth_token: @user.authentication_token
41 41 expect(response).to be_success
42 42 notices = JSON.load response.body
43 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 82  
83 83 describe "given a date range" do
84 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 86 expect(response).to be_success
87 87 problems = JSON.load response.body
88 88 expect(problems.length).to eq 2
... ... @@ -90,7 +90,7 @@ describe Api::V1::ProblemsController, type: &#39;controller&#39; do
90 90 end
91 91  
92 92 it "should return all problems" do
93   - get :index, { auth_token: @user.authentication_token }
  93 + get :index, auth_token: @user.authentication_token
94 94 expect(response).to be_success
95 95 problems = JSON.load response.body
96 96 expect(problems.length).to eq 4
... ...
spec/controllers/api/v3/notices_controller_spec.rb
... ... @@ -15,10 +15,10 @@ describe Api::V3::NoticesController, type: :controller do
15 15 it 'returns created notice id in json format' do
16 16 post :create, legit_body, legit_params
17 17 notice = Notice.last
18   - expect(JSON.parse(response.body)).to eq({
  18 + expect(JSON.parse(response.body)).to eq(
19 19 'id' => notice.id.to_s,
20 20 'url' => app_problem_url(app, notice.problem)
21   - })
  21 + )
22 22 end
23 23  
24 24 it 'responds with 400 when request attributes are not valid' do
... ... @@ -30,7 +30,7 @@ describe Api::V3::NoticesController, type: :controller do
30 30 end
31 31  
32 32 it 'responds with 422 when project_id is invalid' do
33   - post :create, legit_body, { project_id: 'hm?', key: 'wha?' }
  33 + post :create, legit_body, project_id: 'hm?', key: 'wha?'
34 34  
35 35 expect(response.status).to eq(422)
36 36 expect(response.body).to eq('Your API key is unknown')
... ... @@ -38,7 +38,7 @@ describe Api::V3::NoticesController, type: :controller do
38 38  
39 39 it 'ignores notices for older api' do
40 40 app = Fabricate(:app, current_app_version: '2.0')
41   - post :create, legit_body, { project_id: app.api_key, key: app.api_key }
  41 + post :create, legit_body, project_id: app.api_key, key: app.api_key
42 42 expect(response.body).to eq('Notice for old app version ignored')
43 43 expect(Notice.count).to eq(0)
44 44 end
... ...
spec/controllers/deploys_controller_spec.rb
... ... @@ -21,14 +21,12 @@ describe DeploysController, type: &#39;controller&#39; do
21 21 it 'creates a deploy' do
22 22 expect(App).to receive(:find_by_api_key!).and_return(@app)
23 23 expect(@app.deploys).to receive(:create!).
24   - with({
  24 + with(
25 25 username: 'john.doe',
26 26 environment: 'production',
27 27 repository: 'git@github.com/errbit/errbit.git',
28 28 revision: '19d77837eef37902cf5df7e4445c85f392a8d0d5',
29   - message: 'johns first deploy'
30   -
31   - }).and_return(Fabricate(:deploy))
  29 + message: 'johns first deploy').and_return(Fabricate(:deploy))
32 30 post :create, deploy: @params, api_key: 'APIKEY'
33 31 end
34 32  
... ...
spec/controllers/devise_sessions_controller_spec.rb
... ... @@ -10,12 +10,12 @@ describe Devise::SessionsController, type: &#39;controller&#39; do
10 10 let(:user) { Fabricate(:user) }
11 11  
12 12 it 'redirects to app index page if there are no apps for the user' do
13   - post :create, { user: { 'email' => user.email, 'password' => user.password } }
  13 + post :create, user: { 'email' => user.email, 'password' => user.password }
14 14 expect(response).to redirect_to(root_path)
15 15 end
16 16  
17 17 it 'displays a friendly error when credentials are invalid' do
18   - post :create, { user: { 'email' => 'whatever', 'password' => 'somethinginvalid' } }
  18 + post :create, user: { 'email' => 'whatever', 'password' => 'somethinginvalid' }
19 19 expect(request.flash["alert"]).to eq(I18n.t 'devise.failure.user.email_invalid')
20 20 end
21 21 end
... ...
spec/controllers/users_controller_spec.rb
... ... @@ -232,12 +232,12 @@ describe UsersController, type: &#39;controller&#39; do
232 232 }
233 233 let(:user_param) { { 'user' => { name: 'foo', admin: true } } }
234 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 236 end
237 237 context "with password and password_confirmation empty?" do
238 238 let(:user_param) { { 'user' => { :name => 'foo', 'password' => '', 'password_confirmation' => '' } } }
239 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 241 end
242 242 end
243 243 end
... ...
spec/decorators/issue_tracker_field_decorator.rb
1 1 describe IssueTrackerFieldDecorator do
2 2 describe "#label" do
3 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 5 end
6 6  
7 7 it 'return the key of field if no label define' do
... ...
spec/decorators/issue_tracker_type_decorator_spec.rb
... ... @@ -24,9 +24,7 @@ describe IssueTrackerDecorator do
24 24 end
25 25 end
26 26  
27   - allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return({
28   - fake: klass
29   - })
  27 + allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return(fake: klass)
30 28  
31 29 klass
32 30 end
... ...
spec/initializers/action_mailer_spec.rb
... ... @@ -34,14 +34,14 @@ describe &#39;initializers/action_mailer&#39; do
34 34 allow(Errbit::Config).to receive(:smtp_domain).and_return('someotherdomain.com')
35 35 load_initializer
36 36  
37   - expect(ActionMailer::Base.smtp_settings).to eq({
  37 + expect(ActionMailer::Base.smtp_settings).to eq(
38 38 address: 'smtp.somedomain.com',
39 39 port: 998,
40 40 authentication: :login,
41 41 user_name: 'my-username',
42 42 password: 'my-password',
43 43 domain: 'someotherdomain.com'
44   - })
  44 + )
45 45 end
46 46 end
47 47 end
... ...
spec/initializers/devise_spec.rb
... ... @@ -14,11 +14,10 @@ describe &#39;initializers/devise&#39; do
14 14  
15 15 options = Devise.omniauth_configs[:github].options
16 16 expect(options).to have_key(:client_options)
17   - expect(options[:client_options]).to eq({
  17 + expect(options[:client_options]).to eq(
18 18 site: 'https://api.github.com',
19 19 authorize_url: 'https://github.com/login/oauth/authorize',
20   - token_url: 'https://github.com/login/oauth/access_token'
21   - })
  20 + token_url: 'https://github.com/login/oauth/access_token')
22 21 end
23 22  
24 23 it 'sets the client options correctly for the a GitHub Enterprise github_url' do
... ... @@ -28,11 +27,10 @@ describe &#39;initializers/devise&#39; do
28 27  
29 28 options = Devise.omniauth_configs[:github].options
30 29 expect(options).to have_key(:client_options)
31   - expect(options[:client_options]).to eq({
  30 + expect(options[:client_options]).to eq(
32 31 site: 'https://github.example.com/api/v3',
33 32 authorize_url: 'https://github.example.com/login/oauth/authorize',
34   - token_url: 'https://github.example.com/login/oauth/access_token'
35   - })
  33 + token_url: 'https://github.example.com/login/oauth/access_token')
36 34 end
37 35 end
38 36 end
... ...
spec/interactors/problem_destroy_spec.rb
... ... @@ -40,7 +40,7 @@ describe ProblemDestroy do
40 40 end
41 41  
42 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 44 problem_destroy.execute
45 45 end
46 46 end
... ...
spec/interactors/resolved_problem_clearer_spec.rb
... ... @@ -20,7 +20,7 @@ describe ResolvedProblemClearer do
20 20 end
21 21 it 'not repair database' do
22 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 24 resolved_problem_clearer.execute
25 25 end
26 26 end
... ... @@ -28,7 +28,7 @@ describe ResolvedProblemClearer do
28 28 context "with problem resolve" do
29 29 before do
30 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 32 problems.first.resolve!
33 33 problems.second.resolve!
34 34 end
... ... @@ -44,7 +44,7 @@ describe ResolvedProblemClearer do
44 44 end
45 45  
46 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 48 resolved_problem_clearer.execute
49 49 end
50 50 end
... ...
spec/lib/airbrake_api/v3/notice_parser_spec.rb
... ... @@ -7,7 +7,7 @@ describe AirbrakeApi::V3::NoticeParser do
7 7 }.to raise_error(AirbrakeApi::ParamsError)
8 8  
9 9 expect {
10   - AirbrakeApi::V3::NoticeParser.new({ 'errors' => [] }).report
  10 + AirbrakeApi::V3::NoticeParser.new('errors' => []).report
11 11 }.to raise_error(AirbrakeApi::ParamsError)
12 12 end
13 13  
... ... @@ -20,7 +20,12 @@ describe AirbrakeApi::V3::NoticeParser do
20 20 expect(report.error_class).to eq('Error')
21 21 expect(report.message).to eq('Error: TestError')
22 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(
  24 + 'Id' => 1,
  25 + 'Name' => 'John Doe',
  26 + 'Email' => 'john.doe@example.org',
  27 + 'Username' => 'john'
  28 + )
24 29 expect(notice.session).to include('isAdmin' => true)
25 30 expect(notice.params).to include('returnTo' => 'dashboard')
26 31 expect(notice.env_vars).to include(
... ...
spec/lib/configurator_spec.rb
... ... @@ -6,56 +6,52 @@ describe Configurator do
6 6 end
7 7  
8 8 it 'takes the first existing env, second item' do
9   - result = Configurator.run({ two: %w(VARTWO VARTHREE) })
  9 + result = Configurator.run(two: %w(VARTWO VARTHREE))
10 10 expect(result.two).to eq('zipp')
11 11 end
12 12  
13 13 it 'takes the first existing env, first item' do
14   - result = Configurator.run({ three: %w(VARTHREE VARONE) })
  14 + result = Configurator.run(three: %w(VARTHREE VARONE))
15 15 expect(result.three).to eq('zipp')
16 16 end
17 17  
18 18 it 'provides nothing for missing variables' do
19   - result = Configurator.run({ four: ['VAREIGHTY'] })
  19 + result = Configurator.run(four: ['VAREIGHTY'])
20 20 expect(result.four).to be_nil
21 21 end
22 22  
23 23 it 'overrides existing variables' do
24   - result = Configurator.run({
25   - one: ['VARONE', ->(_values) { 'oveRIIIDE' }]
26   - })
  24 + result = Configurator.run(one: ['VARONE', ->(_values) { 'oveRIIIDE' }])
27 25 expect(result.one).to eq('oveRIIIDE')
28 26 end
29 27  
30 28 it 'overrides can refer to other values' do
31   - result = Configurator.run({
32   - one: ['VARONE', ->(values) { values[:one] }],
33   - three: ['VARTHREE']
34   - })
  29 + result = Configurator.run(one: ['VARONE', ->(values) { values[:one] }],
  30 + three: ['VARTHREE'])
35 31 expect(result.one).to eq('zoom')
36 32 end
37 33  
38 34 it 'extracts symbol values' do
39 35 allow(ENV).to receive(:[]).with('MYSYMBOL').and_return(':asymbol')
40   - result = Configurator.run({ mysymbol: ['MYSYMBOL'] })
  36 + result = Configurator.run(mysymbol: ['MYSYMBOL'])
41 37 expect(result.mysymbol).to be(:asymbol)
42 38 end
43 39  
44 40 it 'extracts array values' do
45 41 allow(ENV).to receive(:[]).with('MYARRAY').and_return('[one,two,three]')
46   - result = Configurator.run({ myarray: ['MYARRAY'] })
  42 + result = Configurator.run(myarray: ['MYARRAY'])
47 43 expect(result.myarray).to eq(%w(one two three))
48 44 end
49 45  
50 46 it 'extracts booleans' do
51 47 allow(ENV).to receive(:[]).with('MYBOOLEAN').and_return('true')
52   - result = Configurator.run({ myboolean: ['MYBOOLEAN'] })
  48 + result = Configurator.run(myboolean: ['MYBOOLEAN'])
53 49 expect(result.myboolean).to be(true)
54 50 end
55 51  
56 52 it 'extracts numbers' do
57 53 allow(ENV).to receive(:[]).with('MYNUMBER').and_return('0')
58   - result = Configurator.run({ mynumber: ['MYNUMBER'] })
  54 + result = Configurator.run(mynumber: ['MYNUMBER'])
59 55 expect(result.mynumber).to be(0)
60 56 end
61 57 end
... ...
spec/models/app_spec.rb
... ... @@ -173,10 +173,11 @@ describe App, type: &#39;model&#39; do
173 173 }
174 174  
175 175 it 'returns the correct err if one already exists' do
176   - existing = Fabricate(:err, {
  176 + existing = Fabricate(
  177 + :err,
177 178 problem: Fabricate(:problem, app: app),
178 179 fingerprint: conditions[:fingerprint]
179   - })
  180 + )
180 181 expect(Err.where(fingerprint: conditions[:fingerprint]).first).to eq existing
181 182 expect(app.find_or_create_err!(conditions)).to eq existing
182 183 end
... ...
spec/models/notice_spec.rb
... ... @@ -115,7 +115,7 @@ describe Notice, type: &#39;model&#39; do
115 115 it "returns the cgi-data" do
116 116 notice = Notice.new
117 117 notice.request = { 'cgi-data' => { 'ONE' => 'TWO' } }
118   - expect(notice.env_vars).to eq({ 'ONE' => 'TWO' })
  118 + expect(notice.env_vars).to eq('ONE' => 'TWO')
119 119 end
120 120  
121 121 it "always returns a hash" do
... ...
spec/models/problem_spec.rb
... ... @@ -273,7 +273,7 @@ describe Problem, type: &#39;model&#39; do
273 273 expect {
274 274 @err.notices.first.destroy
275 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 277 end
278 278  
279 279 it "removing a notice from the problem with broken counter should not raise an error" do
... ... @@ -300,7 +300,7 @@ describe Problem, type: &#39;model&#39; do
300 300 expect {
301 301 @err.notices.first.destroy
302 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 304 end
305 305 end
306 306  
... ... @@ -316,13 +316,23 @@ describe Problem, type: &#39;model&#39; do
316 316 end
317 317  
318 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(
  320 + :notice,
  321 + err: @err,
  322 + request: {
  323 + 'cgi-data' => {
  324 + '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'
  325 + }
  326 + }
  327 + )
320 328 expect {
321 329 @err.notices.first.destroy
322 330 @problem.reload
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 }
325   - }).to({})
  331 + }.to change(@problem, :user_agents).
  332 + from(
  333 + Digest::MD5.hexdigest('Chrome 10.0.648.204 (OS X 10.6.7)') => {
  334 + 'value' => 'Chrome 10.0.648.204 (OS X 10.6.7)', 'count' => 1 }
  335 + ).to({})
326 336 end
327 337 end
328 338  
... ... @@ -437,21 +447,21 @@ describe Problem, type: &#39;model&#39; do
437 447 end
438 448  
439 449 it 'update stats messages' do
440   - expect(problem.messages).to eq({
  450 + expect(problem.messages).to eq(
441 451 Digest::MD5.hexdigest(notice.message) => { 'value' => notice.message, 'count' => 1 }
442   - })
  452 + )
443 453 end
444 454  
445 455 it 'update stats hosts' do
446   - expect(problem.hosts).to eq({
  456 + expect(problem.hosts).to eq(
447 457 Digest::MD5.hexdigest(notice.host) => { 'value' => notice.host, 'count' => 1 }
448   - })
  458 + )
449 459 end
450 460  
451 461 it 'update stats user_agents' do
452   - expect(problem.user_agents).to eq({
  462 + expect(problem.user_agents).to eq(
453 463 Digest::MD5.hexdigest(notice.user_agent_string) => { 'value' => notice.user_agent_string, 'count' => 1 }
454   - })
  464 + )
455 465 end
456 466 end
457 467  
... ... @@ -477,21 +487,15 @@ describe Problem, type: &#39;model&#39; do
477 487 end
478 488  
479 489 it 'update stats messages' do
480   - expect(problem.messages).to eq({
481   - Digest::MD5.hexdigest(notice.message) => { 'value' => notice.message, 'count' => 3 }
482   - })
  490 + expect(problem.messages).to eq(Digest::MD5.hexdigest(notice.message) => { 'value' => notice.message, 'count' => 3 })
483 491 end
484 492  
485 493 it 'update stats hosts' do
486   - expect(problem.hosts).to eq({
487   - Digest::MD5.hexdigest(notice.host) => { 'value' => notice.host, 'count' => 3 }
488   - })
  494 + expect(problem.hosts).to eq(Digest::MD5.hexdigest(notice.host) => { 'value' => notice.host, 'count' => 3 })
489 495 end
490 496  
491 497 it 'update stats user_agents' do
492   - expect(problem.user_agents).to eq({
493   - Digest::MD5.hexdigest(notice.user_agent_string) => { 'value' => notice.user_agent_string, 'count' => 3 }
494   - })
  498 + expect(problem.user_agents).to eq(Digest::MD5.hexdigest(notice.user_agent_string) => { 'value' => notice.user_agent_string, 'count' => 3 })
495 499 end
496 500 end
497 501 end
... ...