diff --git a/.travis.yml b/.travis.yml index 51c3f3a..a9f345a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ rvm: - ruby-head - jruby-head env: - - RAILS_ENV=test COVERAGE=true JRUBY_OPTS=--debug + - COVERAGE=true JRUBY_OPTS=--debug sudo: false cache: bundler before_script: diff --git a/Gemfile b/Gemfile index 683cd0b..9095a25 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -RAILS_VERSION = '~> 4.1.11' +RAILS_VERSION = '~> 4.2.0' send :ruby, ENV['GEMFILE_RUBY_VERSION'] if ENV['GEMFILE_RUBY_VERSION'] @@ -81,7 +81,7 @@ group :test do gem 'rspec-rails', '~> 3.0', require: false gem 'rspec-activemodel-mocks' gem 'rspec-its' - gem 'mongoid-rspec', require: false + gem 'mongoid-rspec', '~> 2.3.0.beta', require: false gem 'fabrication' gem 'capybara' gem 'poltergeist' diff --git a/Gemfile.lock b/Gemfile.lock index a423491..eba9fba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,41 +1,50 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.12) - actionpack (= 4.1.12) - actionview (= 4.1.12) + actionmailer (4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) actionmailer_inline_css (1.5.3) actionmailer (>= 3.0.0) nokogiri (>= 1.4.4) premailer (>= 1.7.1) - actionpack (4.1.12) - actionview (= 4.1.12) - activesupport (= 4.1.12) - rack (~> 1.5.2) + actionpack (4.2.3) + actionview (= 4.2.3) + activesupport (= 4.2.3) + rack (~> 1.6) rack-test (~> 0.6.2) - actionview (4.1.12) - activesupport (= 4.1.12) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.3) + activesupport (= 4.2.3) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.12) - activesupport (= 4.1.12) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.3) + activesupport (= 4.2.3) + globalid (>= 0.3.0) + activemodel (4.2.3) + activesupport (= 4.2.3) builder (~> 3.1) - activerecord (4.1.12) - activemodel (= 4.1.12) - activesupport (= 4.1.12) - arel (~> 5.0.0) - activesupport (4.1.12) - i18n (~> 0.6, >= 0.6.9) + activerecord (4.2.3) + activemodel (= 4.2.3) + activesupport (= 4.2.3) + arel (~> 6.0) + activesupport (4.2.3) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) airbrake (4.3.0) builder multi_json - arel (5.0.1.20140414130214) + arel (6.0.3) bcrypt (3.1.10) bcrypt (3.1.10-java) better_errors (2.1.1) @@ -127,6 +136,8 @@ GEM flowdock (0.6.0) httparty (~> 0.7) multi_json + globalid (0.3.6) + activesupport (>= 4.1.0) haml (4.0.6) tilt hashie (3.4.2) @@ -162,6 +173,8 @@ GEM addressable (~> 2.3) spoon (~> 0.0.1) libv8 (3.16.14.7) + loofah (2.0.3) + nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) meta_request (0.3.4) @@ -172,7 +185,7 @@ GEM mime-types (2.6.1) mimemagic (0.3.0) mini_portile (0.6.2) - minitest (5.7.0) + minitest (5.8.0) mongo (2.1.0.beta) bson (~> 3.0) mongoid (5.0.0.beta) @@ -180,10 +193,10 @@ GEM mongo (= 2.1.0.beta) origin (~> 2.1) tzinfo (>= 0.3.37) - mongoid-rspec (1.10.0) - mongoid (>= 3.0.1) + mongoid-rspec (2.3.0.beta) + mongoid (= 5.0.0.beta) rake - rspec (>= 2.14) + rspec (~> 3.3) mongoid_rails_migrations (1.0.1) activesupport (>= 3.2.0) bundler (>= 1.0.0) @@ -246,7 +259,7 @@ GEM pry (>= 0.9.10) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.5) + rack (1.6.4) rack-contrib (1.2.0) rack (>= 0.9.1) rack-ssl (1.4.1) @@ -254,16 +267,25 @@ GEM rack-ssl-enforcer (0.2.8) rack-test (0.6.3) rack (>= 1.0) - rails (4.1.12) - actionmailer (= 4.1.12) - actionpack (= 4.1.12) - actionview (= 4.1.12) - activemodel (= 4.1.12) - activerecord (= 4.1.12) - activesupport (= 4.1.12) + rails (4.2.3) + actionmailer (= 4.2.3) + actionpack (= 4.2.3) + actionview (= 4.2.3) + activejob (= 4.2.3) + activemodel (= 4.2.3) + activerecord (= 4.2.3) + activesupport (= 4.2.3) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.12) - sprockets-rails (~> 2.0) + railties (= 4.2.3) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging @@ -271,17 +293,17 @@ GEM rails (> 3.1) rails_serve_static_assets (0.0.4) rails_stdout_logging (0.0.3) - railties (4.1.12) - actionpack (= 4.1.12) - activesupport (= 4.1.12) + railties (4.2.3) + actionpack (= 4.2.3) + activesupport (= 4.2.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.13.0) rake (10.4.2) ref (1.0.5) request_store (1.1.0) - responders (1.1.2) - railties (>= 3.2, < 4.2) + responders (2.1.0) + railties (>= 4.2.0, < 5) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) @@ -336,7 +358,7 @@ GEM slop (3.6.0) spoon (0.0.4) ffi - sprockets (3.2.0) + sprockets (3.3.3) rack (~> 1.0) sprockets-rails (2.3.2) actionpack (>= 3.0) @@ -391,9 +413,9 @@ PLATFORMS ruby DEPENDENCIES - actionmailer (~> 4.1.11) + actionmailer (~> 4.2.0) actionmailer_inline_css - actionpack (~> 4.1.11) + actionpack (~> 4.2.0) airbrake better_errors binding_of_caller @@ -426,7 +448,7 @@ DEPENDENCIES launchy meta_request mongoid (= 5.0.0.beta) - mongoid-rspec + mongoid-rspec (~> 2.3.0.beta) mongoid_rails_migrations omniauth-github pjax_rails @@ -438,7 +460,7 @@ DEPENDENCIES rack-ssl-enforcer rails_12factor rails_autolink - railties (~> 4.1.11) + railties (~> 4.2.0) ri_cal rspec (~> 3.3) rspec-activemodel-mocks diff --git a/app/controllers/api/v3/notices_controller.rb b/app/controllers/api/v3/notices_controller.rb index 3ec5404..57637b4 100644 --- a/app/controllers/api/v3/notices_controller.rb +++ b/app/controllers/api/v3/notices_controller.rb @@ -13,10 +13,9 @@ class Api::V3::NoticesController < ApplicationController report.generate_notice! render json: { id: report.notice.id, - url: app_problem_path( + url: app_problem_url( report.app, - report.error.problem_id, - only_path: false) + report.error.problem_id) } else render text: 'Notice for old app version ignored' diff --git a/app/models/comment.rb b/app/models/comment.rb index 862a736..d60c98e 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -17,7 +17,7 @@ class Comment validates_presence_of :body def deliver_email - Mailer.comment_notification(self).deliver + Mailer.comment_notification(self).deliver_now end def notification_recipients diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 71ff354..9d74757 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -40,7 +40,7 @@ class Deploy def deliver_email if app.notify_on_deploys? && app.notification_recipients.any? - Mailer.deploy_notification(self).deliver + Mailer.deploy_notification(self).deliver_now end end diff --git a/app/models/error_report.rb b/app/models/error_report.rb index fd7a7ba..8d1123a 100644 --- a/app/models/error_report.rb +++ b/app/models/error_report.rb @@ -85,7 +85,7 @@ class ErrorReport def email_notification return false unless app.emailable? return false unless app.email_at_notices.include?(@problem.notices_count) - Mailer.err_notification(self).deliver + Mailer.err_notification(self).deliver_now rescue => e HoptoadNotifier.notify(e) end diff --git a/config/application.rb b/config/application.rb index 6eae88d..cc0f182 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,7 +20,7 @@ module Errbit config.before_initialize do config.secret_key_base = Errbit::Config.secret_key_base - config.serve_static_assets = Errbit::Config.serve_static_assets + config.serve_static_files = Errbit::Config.serve_static_assets end initializer 'errbit.mongoid', before: 'mongoid.load-config' do diff --git a/config/environments/test.rb b/config/environments/test.rb index 053f5b6..81be655 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,7 +13,7 @@ Rails.application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + config.serve_static_files = true config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. diff --git a/spec/controllers/api/v3/notices_controller_spec.rb b/spec/controllers/api/v3/notices_controller_spec.rb index 0b18905..920de59 100644 --- a/spec/controllers/api/v3/notices_controller_spec.rb +++ b/spec/controllers/api/v3/notices_controller_spec.rb @@ -11,7 +11,7 @@ describe Api::V3::NoticesController, type: :controller do notice = Notice.last expect(JSON.parse(response.body)).to eq({ 'id' => notice.id.to_s, - 'url' => app_problem_path(app, notice.problem, only_path: false) + 'url' => app_problem_url(app, notice.problem) }) end diff --git a/spec/initializers/action_mailer_spec.rb b/spec/initializers/action_mailer_spec.rb index 50afff7..b9d82bd 100644 --- a/spec/initializers/action_mailer_spec.rb +++ b/spec/initializers/action_mailer_spec.rb @@ -3,6 +3,10 @@ describe 'initializers/action_mailer' do load File.join(Rails.root, 'config', 'initializers', 'action_mailer.rb') end + after do + ActionMailer::Base.delivery_method = :test + end + describe 'delivery method' do it 'sets the delivery method to :smtp' do allow(Errbit::Config).to receive(:email_delivery_method).and_return(:smtp) diff --git a/spec/mailers/mailer_spec.rb b/spec/mailers/mailer_spec.rb index c5b7bb0..e7ac839 100644 --- a/spec/mailers/mailer_spec.rb +++ b/spec/mailers/mailer_spec.rb @@ -61,7 +61,7 @@ describe Mailer do ) end let(:email) do - Mailer.err_notification(error_report).deliver + Mailer.err_notification(error_report).deliver_now end before { email } @@ -77,7 +77,7 @@ describe Mailer do end it "should have links to source files" do - expect(email).to have_body_text('path/to/file.js') + expect(email).to have_body_text('path/to/file.js') end it "should have the error count in the subject" do @@ -104,7 +104,7 @@ describe Mailer do before do expect(comment).to receive(:notification_recipients).and_return(recipients) Fabricate(:notice, :err => notice.err) - @email = Mailer.comment_notification(comment).deliver + @email = Mailer.comment_notification(comment).deliver_now end it "should be sent to comment notification recipients" do diff --git a/spec/models/comment_observer_spec.rb b/spec/models/comment_observer_spec.rb index bbf6621..dda3e92 100644 --- a/spec/models/comment_observer_spec.rb +++ b/spec/models/comment_observer_spec.rb @@ -8,7 +8,7 @@ describe "Callback on Comment", type: 'model' do it 'should send an email notification' do expect(Mailer).to receive(:comment_notification). with(comment). - and_return(double('email', :deliver => true)) + and_return(double('email', :deliver_now => true)) comment.save end end diff --git a/spec/models/deploy_observer_spec.rb b/spec/models/deploy_observer_spec.rb index e7b6a54..cece4fe 100644 --- a/spec/models/deploy_observer_spec.rb +++ b/spec/models/deploy_observer_spec.rb @@ -3,7 +3,7 @@ describe "Callback on Deploy", type: 'model' do context 'and the app should notify on deploys' do it 'should send an email notification' do expect(Mailer).to receive(:deploy_notification). - and_return(double('email', :deliver => true)) + and_return(double('email', :deliver_now => true)) Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => true)) end end diff --git a/spec/models/notice_observer_spec.rb b/spec/models/notice_observer_spec.rb index 198c1b9..79abfb3 100644 --- a/spec/models/notice_observer_spec.rb +++ b/spec/models/notice_observer_spec.rb @@ -49,7 +49,7 @@ describe "Callback on Notice", type: 'model' do @problem.update_attributes notices_count: threshold - 1 expect(Mailer).to receive(:err_notification). - and_return(double('email', :deliver => true)) + and_return(double('email', :deliver_now => true)) error_report = ErrorReport.new(notice_attrs) error_report.generate_notice! @@ -95,7 +95,7 @@ describe "Callback on Notice", type: 'model' do err.problem.resolve! expect(Mailer).to receive(:err_notification) - .and_return(double('email', :deliver => true)) + .and_return(double('email', :deliver_now => true)) ErrorReport.new(notice_attrs).generate_notice! end @@ -121,7 +121,7 @@ describe "Callback on Notice", type: 'model' do expect(error_report.app.notification_service) .to receive(:create_notification).and_raise(ArgumentError) expect(Mailer) - .to receive(:err_notification).and_return(double(:deliver => true)) + .to receive(:err_notification).and_return(double(:deliver_now => true)) error_report.generate_notice! end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8b5b786..3fe6063 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,6 +33,7 @@ require 'errbit_plugin/mock_issue_tracker' Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} Mongoid::Config.truncate! Mongoid::Tasks::Database.create_indexes +ActionMailer::Base.delivery_method = :test RSpec.configure do |config| config.include Devise::TestHelpers, :type => :controller -- libgit2 0.21.2