Commit a5104f32a12b1d0a2cd93af65d869b7e995e457a

Authored by Stephen Crosby
1 parent df414015
Exists in master and in 1 other branch production

upgrade to rails 4.2

.travis.yml
... ... @@ -6,7 +6,7 @@ rvm:
6 6 - ruby-head
7 7 - jruby-head
8 8 env:
9   - - RAILS_ENV=test COVERAGE=true JRUBY_OPTS=--debug
  9 + - COVERAGE=true JRUBY_OPTS=--debug
10 10 sudo: false
11 11 cache: bundler
12 12 before_script:
... ...
Gemfile
1 1 source 'https://rubygems.org'
2 2  
3   -RAILS_VERSION = '~> 4.1.11'
  3 +RAILS_VERSION = '~> 4.2.0'
4 4  
5 5 send :ruby, ENV['GEMFILE_RUBY_VERSION'] if ENV['GEMFILE_RUBY_VERSION']
6 6  
... ... @@ -81,7 +81,7 @@ group :test do
81 81 gem 'rspec-rails', '~> 3.0', require: false
82 82 gem 'rspec-activemodel-mocks'
83 83 gem 'rspec-its'
84   - gem 'mongoid-rspec', require: false
  84 + gem 'mongoid-rspec', '~> 2.3.0.beta', require: false
85 85 gem 'fabrication'
86 86 gem 'capybara'
87 87 gem 'poltergeist'
... ...
Gemfile.lock
1 1 GEM
2 2 remote: https://rubygems.org/
3 3 specs:
4   - actionmailer (4.1.12)
5   - actionpack (= 4.1.12)
6   - actionview (= 4.1.12)
  4 + actionmailer (4.2.3)
  5 + actionpack (= 4.2.3)
  6 + actionview (= 4.2.3)
  7 + activejob (= 4.2.3)
7 8 mail (~> 2.5, >= 2.5.4)
  9 + rails-dom-testing (~> 1.0, >= 1.0.5)
8 10 actionmailer_inline_css (1.5.3)
9 11 actionmailer (>= 3.0.0)
10 12 nokogiri (>= 1.4.4)
11 13 premailer (>= 1.7.1)
12   - actionpack (4.1.12)
13   - actionview (= 4.1.12)
14   - activesupport (= 4.1.12)
15   - rack (~> 1.5.2)
  14 + actionpack (4.2.3)
  15 + actionview (= 4.2.3)
  16 + activesupport (= 4.2.3)
  17 + rack (~> 1.6)
16 18 rack-test (~> 0.6.2)
17   - actionview (4.1.12)
18   - activesupport (= 4.1.12)
  19 + rails-dom-testing (~> 1.0, >= 1.0.5)
  20 + rails-html-sanitizer (~> 1.0, >= 1.0.2)
  21 + actionview (4.2.3)
  22 + activesupport (= 4.2.3)
19 23 builder (~> 3.1)
20 24 erubis (~> 2.7.0)
21   - activemodel (4.1.12)
22   - activesupport (= 4.1.12)
  25 + rails-dom-testing (~> 1.0, >= 1.0.5)
  26 + rails-html-sanitizer (~> 1.0, >= 1.0.2)
  27 + activejob (4.2.3)
  28 + activesupport (= 4.2.3)
  29 + globalid (>= 0.3.0)
  30 + activemodel (4.2.3)
  31 + activesupport (= 4.2.3)
23 32 builder (~> 3.1)
24   - activerecord (4.1.12)
25   - activemodel (= 4.1.12)
26   - activesupport (= 4.1.12)
27   - arel (~> 5.0.0)
28   - activesupport (4.1.12)
29   - i18n (~> 0.6, >= 0.6.9)
  33 + activerecord (4.2.3)
  34 + activemodel (= 4.2.3)
  35 + activesupport (= 4.2.3)
  36 + arel (~> 6.0)
  37 + activesupport (4.2.3)
  38 + i18n (~> 0.7)
30 39 json (~> 1.7, >= 1.7.7)
31 40 minitest (~> 5.1)
32   - thread_safe (~> 0.1)
  41 + thread_safe (~> 0.3, >= 0.3.4)
33 42 tzinfo (~> 1.1)
34 43 addressable (2.3.8)
35 44 airbrake (4.3.0)
36 45 builder
37 46 multi_json
38   - arel (5.0.1.20140414130214)
  47 + arel (6.0.3)
39 48 bcrypt (3.1.10)
40 49 bcrypt (3.1.10-java)
41 50 better_errors (2.1.1)
... ... @@ -127,6 +136,8 @@ GEM
127 136 flowdock (0.6.0)
128 137 httparty (~> 0.7)
129 138 multi_json
  139 + globalid (0.3.6)
  140 + activesupport (>= 4.1.0)
130 141 haml (4.0.6)
131 142 tilt
132 143 hashie (3.4.2)
... ... @@ -162,6 +173,8 @@ GEM
162 173 addressable (~> 2.3)
163 174 spoon (~> 0.0.1)
164 175 libv8 (3.16.14.7)
  176 + loofah (2.0.3)
  177 + nokogiri (>= 1.5.9)
165 178 mail (2.6.3)
166 179 mime-types (>= 1.16, < 3)
167 180 meta_request (0.3.4)
... ... @@ -172,7 +185,7 @@ GEM
172 185 mime-types (2.6.1)
173 186 mimemagic (0.3.0)
174 187 mini_portile (0.6.2)
175   - minitest (5.7.0)
  188 + minitest (5.8.0)
176 189 mongo (2.1.0.beta)
177 190 bson (~> 3.0)
178 191 mongoid (5.0.0.beta)
... ... @@ -180,10 +193,10 @@ GEM
180 193 mongo (= 2.1.0.beta)
181 194 origin (~> 2.1)
182 195 tzinfo (>= 0.3.37)
183   - mongoid-rspec (1.10.0)
184   - mongoid (>= 3.0.1)
  196 + mongoid-rspec (2.3.0.beta)
  197 + mongoid (= 5.0.0.beta)
185 198 rake
186   - rspec (>= 2.14)
  199 + rspec (~> 3.3)
187 200 mongoid_rails_migrations (1.0.1)
188 201 activesupport (>= 3.2.0)
189 202 bundler (>= 1.0.0)
... ... @@ -246,7 +259,7 @@ GEM
246 259 pry (>= 0.9.10)
247 260 quiet_assets (1.1.0)
248 261 railties (>= 3.1, < 5.0)
249   - rack (1.5.5)
  262 + rack (1.6.4)
250 263 rack-contrib (1.2.0)
251 264 rack (>= 0.9.1)
252 265 rack-ssl (1.4.1)
... ... @@ -254,16 +267,25 @@ GEM
254 267 rack-ssl-enforcer (0.2.8)
255 268 rack-test (0.6.3)
256 269 rack (>= 1.0)
257   - rails (4.1.12)
258   - actionmailer (= 4.1.12)
259   - actionpack (= 4.1.12)
260   - actionview (= 4.1.12)
261   - activemodel (= 4.1.12)
262   - activerecord (= 4.1.12)
263   - activesupport (= 4.1.12)
  270 + rails (4.2.3)
  271 + actionmailer (= 4.2.3)
  272 + actionpack (= 4.2.3)
  273 + actionview (= 4.2.3)
  274 + activejob (= 4.2.3)
  275 + activemodel (= 4.2.3)
  276 + activerecord (= 4.2.3)
  277 + activesupport (= 4.2.3)
264 278 bundler (>= 1.3.0, < 2.0)
265   - railties (= 4.1.12)
266   - sprockets-rails (~> 2.0)
  279 + railties (= 4.2.3)
  280 + sprockets-rails
  281 + rails-deprecated_sanitizer (1.0.3)
  282 + activesupport (>= 4.2.0.alpha)
  283 + rails-dom-testing (1.0.7)
  284 + activesupport (>= 4.2.0.beta, < 5.0)
  285 + nokogiri (~> 1.6.0)
  286 + rails-deprecated_sanitizer (>= 1.0.1)
  287 + rails-html-sanitizer (1.0.2)
  288 + loofah (~> 2.0)
267 289 rails_12factor (0.0.3)
268 290 rails_serve_static_assets
269 291 rails_stdout_logging
... ... @@ -271,17 +293,17 @@ GEM
271 293 rails (> 3.1)
272 294 rails_serve_static_assets (0.0.4)
273 295 rails_stdout_logging (0.0.3)
274   - railties (4.1.12)
275   - actionpack (= 4.1.12)
276   - activesupport (= 4.1.12)
  296 + railties (4.2.3)
  297 + actionpack (= 4.2.3)
  298 + activesupport (= 4.2.3)
277 299 rake (>= 0.8.7)
278 300 thor (>= 0.18.1, < 2.0)
279 301 raindrops (0.13.0)
280 302 rake (10.4.2)
281 303 ref (1.0.5)
282 304 request_store (1.1.0)
283   - responders (1.1.2)
284   - railties (>= 3.2, < 4.2)
  305 + responders (2.1.0)
  306 + railties (>= 4.2.0, < 5)
285 307 rest-client (1.8.0)
286 308 http-cookie (>= 1.0.2, < 2.0)
287 309 mime-types (>= 1.16, < 3.0)
... ... @@ -336,7 +358,7 @@ GEM
336 358 slop (3.6.0)
337 359 spoon (0.0.4)
338 360 ffi
339   - sprockets (3.2.0)
  361 + sprockets (3.3.3)
340 362 rack (~> 1.0)
341 363 sprockets-rails (2.3.2)
342 364 actionpack (>= 3.0)
... ... @@ -391,9 +413,9 @@ PLATFORMS
391 413 ruby
392 414  
393 415 DEPENDENCIES
394   - actionmailer (~> 4.1.11)
  416 + actionmailer (~> 4.2.0)
395 417 actionmailer_inline_css
396   - actionpack (~> 4.1.11)
  418 + actionpack (~> 4.2.0)
397 419 airbrake
398 420 better_errors
399 421 binding_of_caller
... ... @@ -426,7 +448,7 @@ DEPENDENCIES
426 448 launchy
427 449 meta_request
428 450 mongoid (= 5.0.0.beta)
429   - mongoid-rspec
  451 + mongoid-rspec (~> 2.3.0.beta)
430 452 mongoid_rails_migrations
431 453 omniauth-github
432 454 pjax_rails
... ... @@ -438,7 +460,7 @@ DEPENDENCIES
438 460 rack-ssl-enforcer
439 461 rails_12factor
440 462 rails_autolink
441   - railties (~> 4.1.11)
  463 + railties (~> 4.2.0)
442 464 ri_cal
443 465 rspec (~> 3.3)
444 466 rspec-activemodel-mocks
... ...
app/controllers/api/v3/notices_controller.rb
... ... @@ -13,10 +13,9 @@ class Api::V3::NoticesController &lt; ApplicationController
13 13 report.generate_notice!
14 14 render json: {
15 15 id: report.notice.id,
16   - url: app_problem_path(
  16 + url: app_problem_url(
17 17 report.app,
18   - report.error.problem_id,
19   - only_path: false)
  18 + report.error.problem_id)
20 19 }
21 20 else
22 21 render text: 'Notice for old app version ignored'
... ...
app/models/comment.rb
... ... @@ -17,7 +17,7 @@ class Comment
17 17 validates_presence_of :body
18 18  
19 19 def deliver_email
20   - Mailer.comment_notification(self).deliver
  20 + Mailer.comment_notification(self).deliver_now
21 21 end
22 22  
23 23 def notification_recipients
... ...
app/models/deploy.rb
... ... @@ -40,7 +40,7 @@ class Deploy
40 40  
41 41 def deliver_email
42 42 if app.notify_on_deploys? && app.notification_recipients.any?
43   - Mailer.deploy_notification(self).deliver
  43 + Mailer.deploy_notification(self).deliver_now
44 44 end
45 45 end
46 46  
... ...
app/models/error_report.rb
... ... @@ -85,7 +85,7 @@ class ErrorReport
85 85 def email_notification
86 86 return false unless app.emailable?
87 87 return false unless app.email_at_notices.include?(@problem.notices_count)
88   - Mailer.err_notification(self).deliver
  88 + Mailer.err_notification(self).deliver_now
89 89 rescue => e
90 90 HoptoadNotifier.notify(e)
91 91 end
... ...
config/application.rb
... ... @@ -20,7 +20,7 @@ module Errbit
20 20  
21 21 config.before_initialize do
22 22 config.secret_key_base = Errbit::Config.secret_key_base
23   - config.serve_static_assets = Errbit::Config.serve_static_assets
  23 + config.serve_static_files = Errbit::Config.serve_static_assets
24 24 end
25 25  
26 26 initializer 'errbit.mongoid', before: 'mongoid.load-config' do
... ...
config/environments/test.rb
... ... @@ -13,7 +13,7 @@ Rails.application.configure do
13 13 config.eager_load = false
14 14  
15 15 # Configure static asset server for tests with Cache-Control for performance.
16   - config.serve_static_assets = true
  16 + config.serve_static_files = true
17 17 config.static_cache_control = 'public, max-age=3600'
18 18  
19 19 # Show full error reports and disable caching.
... ...
spec/controllers/api/v3/notices_controller_spec.rb
... ... @@ -11,7 +11,7 @@ describe Api::V3::NoticesController, type: :controller do
11 11 notice = Notice.last
12 12 expect(JSON.parse(response.body)).to eq({
13 13 'id' => notice.id.to_s,
14   - 'url' => app_problem_path(app, notice.problem, only_path: false)
  14 + 'url' => app_problem_url(app, notice.problem)
15 15 })
16 16 end
17 17  
... ...
spec/initializers/action_mailer_spec.rb
... ... @@ -3,6 +3,10 @@ describe &#39;initializers/action_mailer&#39; do
3 3 load File.join(Rails.root, 'config', 'initializers', 'action_mailer.rb')
4 4 end
5 5  
  6 + after do
  7 + ActionMailer::Base.delivery_method = :test
  8 + end
  9 +
6 10 describe 'delivery method' do
7 11 it 'sets the delivery method to :smtp' do
8 12 allow(Errbit::Config).to receive(:email_delivery_method).and_return(:smtp)
... ...
spec/mailers/mailer_spec.rb
... ... @@ -61,7 +61,7 @@ describe Mailer do
61 61 )
62 62 end
63 63 let(:email) do
64   - Mailer.err_notification(error_report).deliver
  64 + Mailer.err_notification(error_report).deliver_now
65 65 end
66 66  
67 67 before { email }
... ... @@ -77,7 +77,7 @@ describe Mailer do
77 77 end
78 78  
79 79 it "should have links to source files" do
80   - expect(email).to have_body_text('<a href="http://example.com/path/to/file.js" target="_blank">path/to/file.js')
  80 + expect(email).to have_body_text('<a target="_blank" href="http://example.com/path/to/file.js">path/to/file.js')
81 81 end
82 82  
83 83 it "should have the error count in the subject" do
... ... @@ -104,7 +104,7 @@ describe Mailer do
104 104 before do
105 105 expect(comment).to receive(:notification_recipients).and_return(recipients)
106 106 Fabricate(:notice, :err => notice.err)
107   - @email = Mailer.comment_notification(comment).deliver
  107 + @email = Mailer.comment_notification(comment).deliver_now
108 108 end
109 109  
110 110 it "should be sent to comment notification recipients" do
... ...
spec/models/comment_observer_spec.rb
... ... @@ -8,7 +8,7 @@ describe &quot;Callback on Comment&quot;, type: &#39;model&#39; do
8 8 it 'should send an email notification' do
9 9 expect(Mailer).to receive(:comment_notification).
10 10 with(comment).
11   - and_return(double('email', :deliver => true))
  11 + and_return(double('email', :deliver_now => true))
12 12 comment.save
13 13 end
14 14 end
... ...
spec/models/deploy_observer_spec.rb
... ... @@ -3,7 +3,7 @@ describe &quot;Callback on Deploy&quot;, type: &#39;model&#39; do
3 3 context 'and the app should notify on deploys' do
4 4 it 'should send an email notification' do
5 5 expect(Mailer).to receive(:deploy_notification).
6   - and_return(double('email', :deliver => true))
  6 + and_return(double('email', :deliver_now => true))
7 7 Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => true))
8 8 end
9 9 end
... ...
spec/models/notice_observer_spec.rb
... ... @@ -49,7 +49,7 @@ describe &quot;Callback on Notice&quot;, type: &#39;model&#39; do
49 49 @problem.update_attributes notices_count: threshold - 1
50 50  
51 51 expect(Mailer).to receive(:err_notification).
52   - and_return(double('email', :deliver => true))
  52 + and_return(double('email', :deliver_now => true))
53 53  
54 54 error_report = ErrorReport.new(notice_attrs)
55 55 error_report.generate_notice!
... ... @@ -95,7 +95,7 @@ describe &quot;Callback on Notice&quot;, type: &#39;model&#39; do
95 95 err.problem.resolve!
96 96  
97 97 expect(Mailer).to receive(:err_notification)
98   - .and_return(double('email', :deliver => true))
  98 + .and_return(double('email', :deliver_now => true))
99 99  
100 100 ErrorReport.new(notice_attrs).generate_notice!
101 101 end
... ... @@ -121,7 +121,7 @@ describe &quot;Callback on Notice&quot;, type: &#39;model&#39; do
121 121 expect(error_report.app.notification_service)
122 122 .to receive(:create_notification).and_raise(ArgumentError)
123 123 expect(Mailer)
124   - .to receive(:err_notification).and_return(double(:deliver => true))
  124 + .to receive(:err_notification).and_return(double(:deliver_now => true))
125 125  
126 126 error_report.generate_notice!
127 127 end
... ...
spec/spec_helper.rb
... ... @@ -33,6 +33,7 @@ require &#39;errbit_plugin/mock_issue_tracker&#39;
33 33 Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
34 34 Mongoid::Config.truncate!
35 35 Mongoid::Tasks::Database.create_indexes
  36 +ActionMailer::Base.delivery_method = :test
36 37  
37 38 RSpec.configure do |config|
38 39 config.include Devise::TestHelpers, :type => :controller
... ...