Skip to content
Browse files

cleanup specs and no deps on dm-validations

  • Loading branch information...
1 parent 2e8161b commit 1609a3a487c8c6e418acdb5d2bcdc5e32fbf08b9 @mkristian committed Jan 30, 2013
Showing with 7 additions and 54 deletions.
  1. +1 −1 lib/ixtlan/errors/dumper.rb
  2. +3 −3 lib/ixtlan/errors/resource.rb
  3. +3 −50 spec/dumper_spec.rb
View
2 lib/ixtlan/errors/dumper.rb
@@ -68,7 +68,7 @@ def dump( exception, request, response, session , params )
session,
params )
- if error.valid? and not @to_emails.blank? and not @from_email.blank?
+ if not error.id.nil? and not @to_emails.blank? and not @from_email.blank?
Mailer.error_notification( @from_email,
@to_emails,
exception,
View
6 lib/ixtlan/errors/resource.rb
@@ -33,9 +33,9 @@ def self.storage_name(arg)
property :clazz, String, :required => true, :length => 64
property :message, String, :required => true, :length => 255
- property :backtrace, Text, :required => true, :length => 32768
- property :request, Text, :required => true, :length => 32768
- property :session, Text, :required => true, :length => 16384
+ property :backtrace, Text, :required => false, :length => 32768
+ property :request, Text, :required => false, :length => 32768
+ property :session, Text, :required => false, :length => 16384
property :parameters, Text, :required => false, :length => 32768
#property :body, Text, :required => false, :length => 64536
View
53 spec/dumper_spec.rb
@@ -1,26 +1,9 @@
require 'dm-core'
require 'dm-migrations'
require 'slf4r/ruby_logger'
+require 'ixtlan/errors/resource'
-class Error
- include DataMapper::Resource
-
- property :id, Serial
-
- property :message, String
- property :clazz, String
- property :request, Text
- property :response, Text
- property :session, Text
- property :parameters, Text
- property :backtrace, Text
-
- property :created_at, DateTime
-
- before :save do
- self.created_at = DateTime.now
- end
-end
+Error = Ixtlan::Errors::Error
require 'pony'
Pony.options = { :via => :test }
@@ -55,36 +38,6 @@ def params
end
end
-class NilClass
- def blank?
- true
- end
-end
-
-class String
- def blank?
- size == 0
- end
-end
-
-class Fixnum
- def days
- self
- end
- def ago
- DateTime.now - 86000 * self
- end
-end
-
-class DateTime
- def tv_sec
- sec
- end
- def tv_usec
- 0
- end
-end
-
DataMapper.setup(:default, "sqlite3::memory:")
DataMapper.finalize
DataMapper.auto_migrate!
@@ -113,7 +66,7 @@ def tv_usec
end
it "should clean up error dumps" do
- Error.create(:message => 'msg')
+ Error.create(:message => 'msg', :clazz => StandardError.to_s)
Error.all.size.should > 0
@dumper.keep_dumps = 0
Error.all.size.should == 0

0 comments on commit 1609a3a

Please sign in to comment.
Something went wrong with that request. Please try again.