Commit f45f759b3e6afd6b98bdc24c74268d5e81a837ee
1 parent
e77f238e
Exists in
master
and in
1 other branch
Let's call errors errs
Showing
18 changed files
with
68 additions
and
67 deletions
Show diff stats
app/controllers/apps_controller.rb
... | ... | @@ -33,7 +33,7 @@ class AppsController < ApplicationController |
33 | 33 | def update |
34 | 34 | @app = App.find(params[:id]) |
35 | 35 | |
36 | - if @app.update_attributes!(params[:app]) | |
36 | + if @app.update_attributes(params[:app]) | |
37 | 37 | flash[:success] = "Good news everyone! '#{@app.name}' was successfully updated." |
38 | 38 | redirect_to app_path(@app) |
39 | 39 | else | ... | ... |
app/controllers/errs_controller.rb
... | ... | @@ -24,7 +24,7 @@ class ErrsController < ApplicationController |
24 | 24 | |
25 | 25 | @err.resolve! |
26 | 26 | |
27 | - flash[:success] = 'Great news everyone! The error has been resolved.' | |
27 | + flash[:success] = 'Great news everyone! The err has been resolved.' | |
28 | 28 | redirect_to errs_path |
29 | 29 | end |
30 | 30 | ... | ... |
app/mailers/mailer.rb
app/models/app.rb
... | ... | @@ -14,7 +14,8 @@ class App |
14 | 14 | before_validation :generate_api_key, :on => :create |
15 | 15 | |
16 | 16 | validates_presence_of :name, :api_key |
17 | - validates_uniqueness_of :name, :api_key, :allow_blank => true, :on => :create | |
17 | + validates_uniqueness_of :name, :allow_blank => true | |
18 | + validates_uniqueness_of :api_key, :allow_blank => true | |
18 | 19 | |
19 | 20 | accepts_nested_attributes_for :watchers, :allow_destroy => true, |
20 | 21 | :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } | ... | ... |
app/models/notice.rb
... | ... | @@ -26,7 +26,7 @@ class Notice |
26 | 26 | hoptoad_notice['request']['component'] = 'unknown' if hoptoad_notice['request']['component'].blank? |
27 | 27 | hoptoad_notice['request']['action'] = nil if hoptoad_notice['request']['action'].blank? |
28 | 28 | |
29 | - error = Err.for({ | |
29 | + err = Err.for({ | |
30 | 30 | :app => app, |
31 | 31 | :klass => hoptoad_notice['error']['class'], |
32 | 32 | :component => hoptoad_notice['request']['component'], |
... | ... | @@ -35,7 +35,7 @@ class Notice |
35 | 35 | :fingerprint => hoptoad_notice['fingerprint'] |
36 | 36 | }) |
37 | 37 | |
38 | - error.notices.create!({ | |
38 | + err.notices.create!({ | |
39 | 39 | :message => hoptoad_notice['error']['message'], |
40 | 40 | :backtrace => hoptoad_notice['error']['backtrace']['line'], |
41 | 41 | :server_environment => hoptoad_notice['server-environment'], |
... | ... | @@ -61,7 +61,7 @@ class Notice |
61 | 61 | end |
62 | 62 | |
63 | 63 | def deliver_notification |
64 | - Mailer.error_notification(self).deliver | |
64 | + Mailer.err_notification(self).deliver | |
65 | 65 | end |
66 | 66 | |
67 | 67 | def cache_last_notice_at | ... | ... |
app/views/apps/_fields.html.haml
app/views/apps/index.html.haml
app/views/apps/show.html.haml
1 | 1 | - content_for :title, @app.name |
2 | 2 | - content_for :meta do |
3 | - %strong Errors Caught: | |
3 | + %strong Errs Caught: | |
4 | 4 | = @app.errs.count |
5 | 5 | %strong API Key: |
6 | 6 | = @app.api_key |
... | ... | @@ -27,5 +27,5 @@ |
27 | 27 | %td |
28 | 28 | %em Sadly, no one is watching this app |
29 | 29 | |
30 | -%h3 Errors | |
30 | +%h3 Errs | |
31 | 31 | = render 'errs/table', :errs => @errs |
32 | 32 | \ No newline at end of file | ... | ... |
app/views/errs/_table.html.haml
app/views/errs/all.html.haml
app/views/errs/index.html.haml
... | ... | @@ -0,0 +1,7 @@ |
1 | +An err has just occurred in <%= @notice.err.environment %>: <%= @notice.err.message %> | |
2 | + | |
3 | +This err has occurred <%= pluralize @notice.err.notices.count, 'time' %>. You should really look into it here: | |
4 | + | |
5 | + <%= app_err_notice_url(@app, @notice.err, @notice) %> | |
6 | + | |
7 | +<%= render :partial => 'signature' %> | |
0 | 8 | \ No newline at end of file | ... | ... |
app/views/mailer/error_notification.text.erb
... | ... | @@ -1,7 +0,0 @@ |
1 | -An error has just occurred in <%= @notice.err.environment %>: <%= @notice.err.message %> | |
2 | - | |
3 | -This error has occurred <%= pluralize @notice.err.notices.count, 'time' %>. You should really look into it here: | |
4 | - | |
5 | - <%= app_err_notice_url(@app, @notice.err, @notice) %> | |
6 | - | |
7 | -<%= render :partial => 'signature' %> | |
8 | 0 | \ No newline at end of file |
app/views/shared/_navigation.html.haml
... | ... | @@ -2,5 +2,5 @@ |
2 | 2 | %ul |
3 | 3 | //%li= link_to 'Dashboard', admin_dashboard_path, :class => active_if_here(:dashboards) |
4 | 4 | %li.apps{:class => active_if_here(:apps)}= link_to 'Apps', apps_path |
5 | - %li.errors{:class => active_if_here(:errs)}= link_to 'Errs', errs_path | |
5 | + %li.errs{:class => active_if_here(:errs)}= link_to 'Errs', errs_path | |
6 | 6 | %div.clear |
7 | 7 | \ No newline at end of file | ... | ... |
public/stylesheets/application.css
... | ... | @@ -87,7 +87,7 @@ header #site-name { |
87 | 87 | } |
88 | 88 | #nav-bar li a:hover { color: #666;} |
89 | 89 | #nav-bar li.apps a { background-image: url(images/icons/briefcase.png); } |
90 | -#nav-bar li.errors a { background-image: url(images/icons/error.png); } | |
90 | +#nav-bar li.errs a { background-image: url(images/icons/error.png); } | |
91 | 91 | #nav-bar li:hover { |
92 | 92 | box-shadow: 0 0 3px #69c; |
93 | 93 | -moz-box-shadow: 0 0 3px #69c; | ... | ... |
spec/controllers/errs_controller_spec.rb
... | ... | @@ -6,27 +6,27 @@ describe ErrsController do |
6 | 6 | let(:err) { Factory(:err, :app => app) } |
7 | 7 | |
8 | 8 | describe "GET /errs" do |
9 | - it "gets a paginated list of unresolved errors" do | |
10 | - errors = WillPaginate::Collection.new(1,30) | |
11 | - 3.times { errors << Factory(:err) } | |
9 | + it "gets a paginated list of unresolved errs" do | |
10 | + errs = WillPaginate::Collection.new(1,30) | |
11 | + 3.times { errs << Factory(:err) } | |
12 | 12 | Err.should_receive(:unresolved).and_return( |
13 | - mock('proxy', :ordered => mock('proxy', :paginate => errors)) | |
13 | + mock('proxy', :ordered => mock('proxy', :paginate => errs)) | |
14 | 14 | ) |
15 | 15 | get :index |
16 | - assigns(:errs).should == errors | |
16 | + assigns(:errs).should == errs | |
17 | 17 | end |
18 | 18 | end |
19 | 19 | |
20 | 20 | describe "GET /errs/all" do |
21 | - it "gets a paginated list of all errors" do | |
22 | - errors = WillPaginate::Collection.new(1,30) | |
23 | - 3.times { errors << Factory(:err) } | |
24 | - 3.times { errors << Factory(:err, :resolved => true)} | |
21 | + it "gets a paginated list of all errs" do | |
22 | + errs = WillPaginate::Collection.new(1,30) | |
23 | + 3.times { errs << Factory(:err) } | |
24 | + 3.times { errs << Factory(:err, :resolved => true)} | |
25 | 25 | Err.should_receive(:ordered).and_return( |
26 | - mock('proxy', :paginate => errors) | |
26 | + mock('proxy', :paginate => errs) | |
27 | 27 | ) |
28 | 28 | get :index |
29 | - assigns(:errs).should == errors | |
29 | + assigns(:errs).should == errs | |
30 | 30 | end |
31 | 31 | end |
32 | 32 | ... | ... |
spec/models/err_spec.rb
... | ... | @@ -4,15 +4,15 @@ describe Err do |
4 | 4 | |
5 | 5 | context 'validations' do |
6 | 6 | it 'requires a klass' do |
7 | - error = Factory.build(:err, :klass => nil) | |
8 | - error.should_not be_valid | |
9 | - error.errors[:klass].should include("can't be blank") | |
7 | + err = Factory.build(:err, :klass => nil) | |
8 | + err.should_not be_valid | |
9 | + err.errors[:klass].should include("can't be blank") | |
10 | 10 | end |
11 | 11 | |
12 | 12 | it 'requires an environment' do |
13 | - error = Factory.build(:err, :environment => nil) | |
14 | - error.should_not be_valid | |
15 | - error.errors[:environment].should include("can't be blank") | |
13 | + err = Factory.build(:err, :environment => nil) | |
14 | + err.should_not be_valid | |
15 | + err.errors[:environment].should include("can't be blank") | |
16 | 16 | end |
17 | 17 | end |
18 | 18 | |
... | ... | @@ -28,16 +28,16 @@ describe Err do |
28 | 28 | } |
29 | 29 | end |
30 | 30 | |
31 | - it 'returns the correct error if one already exists' do | |
31 | + it 'returns the correct err if one already exists' do | |
32 | 32 | existing = Err.create(@conditions) |
33 | 33 | Err.for(@conditions).should == existing |
34 | 34 | end |
35 | 35 | |
36 | - it 'assigns the returned error to the given app' do | |
36 | + it 'assigns the returned err to the given app' do | |
37 | 37 | Err.for(@conditions).app.should == @app |
38 | 38 | end |
39 | 39 | |
40 | - it 'creates a new error if a matching one does not already exist' do | |
40 | + it 'creates a new err if a matching one does not already exist' do | |
41 | 41 | Err.where(@conditions.except(:app)).exists?.should == false |
42 | 42 | lambda { |
43 | 43 | Err.for(@conditions) |
... | ... | @@ -47,14 +47,14 @@ describe Err do |
47 | 47 | |
48 | 48 | context '#last_notice_at' do |
49 | 49 | it "returns the created_at timestamp of the latest notice" do |
50 | - error = Factory(:err) | |
51 | - error.last_notice_at.should be_nil | |
50 | + err = Factory(:err) | |
51 | + err.last_notice_at.should be_nil | |
52 | 52 | |
53 | - notice1 = Factory(:notice, :err => error) | |
54 | - error.last_notice_at.should == notice1.created_at | |
53 | + notice1 = Factory(:notice, :err => err) | |
54 | + err.last_notice_at.should == notice1.created_at | |
55 | 55 | |
56 | - notice2 = Factory(:notice, :err => error) | |
57 | - error.last_notice_at.should == notice2.created_at | |
56 | + notice2 = Factory(:notice, :err => err) | |
57 | + err.last_notice_at.should == notice2.created_at | |
58 | 58 | end |
59 | 59 | end |
60 | 60 | |
... | ... | @@ -69,28 +69,28 @@ describe Err do |
69 | 69 | |
70 | 70 | context "#resolved?" do |
71 | 71 | it "should start out as unresolved" do |
72 | - error = Err.new | |
73 | - error.should_not be_resolved | |
74 | - error.should be_unresolved | |
72 | + err = Err.new | |
73 | + err.should_not be_resolved | |
74 | + err.should be_unresolved | |
75 | 75 | end |
76 | 76 | |
77 | 77 | it "should be able to be resolved" do |
78 | - error = Factory(:err) | |
79 | - error.should_not be_resolved | |
80 | - error.resolve! | |
81 | - error.reload.should be_resolved | |
78 | + err = Factory(:err) | |
79 | + err.should_not be_resolved | |
80 | + err.resolve! | |
81 | + err.reload.should be_resolved | |
82 | 82 | end |
83 | 83 | end |
84 | 84 | |
85 | 85 | context "resolve!" do |
86 | - it "marks the error as resolved" do | |
86 | + it "marks the err as resolved" do | |
87 | 87 | err = Factory(:err) |
88 | 88 | err.should_not be_resolved |
89 | 89 | err.resolve! |
90 | 90 | err.should be_resolved |
91 | 91 | end |
92 | 92 | |
93 | - it "should throw an error if it's not successful" do | |
93 | + it "should throw an err if it's not successful" do | |
94 | 94 | err = Factory(:err) |
95 | 95 | err.should_not be_resolved |
96 | 96 | err.klass = nil |
... | ... | @@ -103,7 +103,7 @@ describe Err do |
103 | 103 | |
104 | 104 | context "Scopes" do |
105 | 105 | context "resolved" do |
106 | - it 'only finds resolved Errors' do | |
106 | + it 'only finds resolved Errs' do | |
107 | 107 | resolved = Factory(:err, :resolved => true) |
108 | 108 | unresolved = Factory(:err, :resolved => false) |
109 | 109 | Err.resolved.all.should include(resolved) |
... | ... | @@ -112,7 +112,7 @@ describe Err do |
112 | 112 | end |
113 | 113 | |
114 | 114 | context "unresolved" do |
115 | - it 'only finds unresolved Errors' do | |
115 | + it 'only finds unresolved Errs' do | |
116 | 116 | resolved = Factory(:err, :resolved => true) |
117 | 117 | unresolved = Factory(:err, :resolved => false) |
118 | 118 | Err.unresolved.all.should_not include(resolved) | ... | ... |
spec/models/notice_spec.rb
... | ... | @@ -34,7 +34,7 @@ describe Notice do |
34 | 34 | @notice.err.app.should == @app |
35 | 35 | end |
36 | 36 | |
37 | - it 'finds the correct error for the notice' do | |
37 | + it 'finds the correct err for the notice' do | |
38 | 38 | Err.should_receive(:for).with({ |
39 | 39 | :app => @app, |
40 | 40 | :klass => 'HoptoadTestingException', |
... | ... | @@ -52,12 +52,12 @@ describe Notice do |
52 | 52 | @notice.should be_persisted |
53 | 53 | end |
54 | 54 | |
55 | - it 'assigns an error to the notice' do | |
55 | + it 'assigns an err to the notice' do | |
56 | 56 | @notice = Notice.from_xml(@xml) |
57 | 57 | @notice.err.should be_a(Err) |
58 | 58 | end |
59 | 59 | |
60 | - it 'captures the error message' do | |
60 | + it 'captures the err message' do | |
61 | 61 | @notice = Notice.from_xml(@xml) |
62 | 62 | @notice.message.should == 'HoptoadTestingException: Testing hoptoad via "rake hoptoad:test". If you can see this, it works.' |
63 | 63 | end |
... | ... | @@ -88,15 +88,15 @@ describe Notice do |
88 | 88 | describe "email notifications" do |
89 | 89 | before do |
90 | 90 | @app = Factory(:app_with_watcher) |
91 | - @error = Factory(:err, :app => @app) | |
91 | + @err = Factory(:err, :app => @app) | |
92 | 92 | end |
93 | 93 | |
94 | 94 | Errbit::Config.email_at_notices.each do |threshold| |
95 | 95 | it "sends an email notification after #{threshold} notice(s)" do |
96 | - @error.notices.stub(:count).and_return(threshold) | |
97 | - Mailer.should_receive(:error_notification). | |
96 | + @err.notices.stub(:count).and_return(threshold) | |
97 | + Mailer.should_receive(:err_notification). | |
98 | 98 | and_return(mock('email', :deliver => true)) |
99 | - Factory(:notice, :err => @error) | |
99 | + Factory(:notice, :err => @err) | |
100 | 100 | end |
101 | 101 | end |
102 | 102 | end | ... | ... |