Commit 4db62f87bed91a91048fe756dd3568038d2cb89c

Authored by Vasiliy Ermolovich
2 parents 6c8532e8 2943c197
Exists in master and in 1 other branch production

Merge pull request #301 from lest/patch-1

call super instead of read_attribute
app/models/notice.rb
@@ -64,7 +64,7 @@ class Notice @@ -64,7 +64,7 @@ class Notice
64 end 64 end
65 65
66 def request 66 def request
67 - read_attribute(:request) || {} 67 + super || {}
68 end 68 end
69 69
70 def url 70 def url
spec/models/notice_spec.rb
1 require 'spec_helper' 1 require 'spec_helper'
2 2
3 describe Notice do 3 describe Notice do
4 -  
5 -  
6 context 'validations' do 4 context 'validations' do
7 it 'requires a backtrace' do 5 it 'requires a backtrace' do
8 notice = Fabricate.build(:notice, :backtrace => nil) 6 notice = Fabricate.build(:notice, :backtrace => nil)
@@ -23,7 +21,6 @@ describe Notice do @@ -23,7 +21,6 @@ describe Notice do
23 end 21 end
24 end 22 end
25 23
26 -  
27 describe "key sanitization" do 24 describe "key sanitization" do
28 before do 25 before do
29 @hash = { "some.key" => { "$nested.key" => {"$Path" => "/", "some$key" => "key"}}} 26 @hash = { "some.key" => { "$nested.key" => {"$Path" => "/", "some$key" => "key"}}}
@@ -38,7 +35,6 @@ describe Notice do @@ -38,7 +35,6 @@ describe Notice do
38 end 35 end
39 end 36 end
40 37
41 -  
42 describe "user agent" do 38 describe "user agent" do
43 it "should be parsed and human-readable" do 39 it "should be parsed and human-readable" do
44 notice = Fabricate.build(:notice, :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'}}) 40 notice = Fabricate.build(:notice, :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'}})
@@ -80,4 +76,11 @@ describe Notice do @@ -80,4 +76,11 @@ describe Notice do
80 notice.host.should == 'N/A' 76 notice.host.should == 'N/A'
81 end 77 end
82 end 78 end
  79 +
  80 + describe "request" do
  81 + it "returns empty hash if not set" do
  82 + notice = Notice.new
  83 + notice.request.should == {}
  84 + end
  85 + end
83 end 86 end