Commit dc29b9db61c7342c01f0cefcee6f7a97295c4654
1 parent
7f720289
Exists in
master
and in
1 other branch
Add test to generate xml from Airbrake gem and test it directly
Try reproduce issue #444
Showing
3 changed files
with
37 additions
and
0 deletions
Show diff stats
Gemfile
... | ... | @@ -78,6 +78,7 @@ gem 'yajl-ruby', :require => "yajl" |
78 | 78 | group :development, :test do |
79 | 79 | gem 'rspec-rails', '~> 2.6' |
80 | 80 | gem 'webmock', :require => false |
81 | + gem 'airbrake', :require => false | |
81 | 82 | unless ENV["CI"] |
82 | 83 | gem 'ruby-debug', :platform => :mri_18 |
83 | 84 | gem 'debugger', :platform => :mri_19 | ... | ... |
Gemfile.lock
... | ... | @@ -47,6 +47,10 @@ GEM |
47 | 47 | i18n (= 0.6.1) |
48 | 48 | multi_json (~> 1.0) |
49 | 49 | addressable (2.3.2) |
50 | + airbrake (3.1.12) | |
51 | + activesupport | |
52 | + builder | |
53 | + json | |
50 | 54 | arel (3.0.2) |
51 | 55 | bcrypt-ruby (3.0.1) |
52 | 56 | better_errors (0.7.0) |
... | ... | @@ -363,6 +367,7 @@ PLATFORMS |
363 | 367 | DEPENDENCIES |
364 | 368 | SystemTimer |
365 | 369 | actionmailer_inline_css (~> 1.3.0) |
370 | + airbrake | |
366 | 371 | better_errors |
367 | 372 | binding_of_caller |
368 | 373 | bitbucket_rest_api | ... | ... |
spec/models/error_report_spec.rb
1 | 1 | require 'spec_helper' |
2 | +require 'airbrake/version' | |
3 | +require 'airbrake/backtrace' | |
4 | +require 'airbrake/notice' | |
5 | + | |
6 | +# MonkeyPatch to instanciate a Airbrake::Notice without configure | |
7 | +# Airbrake | |
8 | +# | |
9 | +module Airbrake | |
10 | + API_VERSION = '2.4' | |
11 | + | |
12 | + class Notice | |
13 | + def framework | |
14 | + 'rails' | |
15 | + end | |
16 | + end | |
17 | +end | |
2 | 18 | |
3 | 19 | describe ErrorReport do |
4 | 20 | context "with notice without line of backtrace" do |
... | ... | @@ -38,6 +54,21 @@ describe ErrorReport do |
38 | 54 | app.reload.problems.count |
39 | 55 | }.by(1) |
40 | 56 | end |
57 | + context "with notice generate by Airbrake gem" do | |
58 | + let(:xml) { Airbrake::Notice.new( | |
59 | + :exception => Exception.new, | |
60 | + :api_key => 'API_KEY', | |
61 | + :project_root => Rails.root | |
62 | + ).to_xml } | |
63 | + it 'save a notice' do | |
64 | + expect { | |
65 | + error_report.generate_notice! | |
66 | + }.to change { | |
67 | + app.reload.problems.count | |
68 | + }.by(1) | |
69 | + end | |
70 | + end | |
71 | + | |
41 | 72 | describe "notice create" do |
42 | 73 | before { error_report.generate_notice! } |
43 | 74 | subject { error_report.notice } | ... | ... |