Permalink
Browse files

Handle error being set to a raw string

* Ignore vim swp files
  • Loading branch information...
Bob Briski Bob Briski
Bob Briski authored and Bob Briski committed Jul 30, 2012
1 parent 0cdcf05 commit d74bf9a299688e6477e55a0d7138fc9f7bcfaaed
Showing with 19 additions and 3 deletions.
  1. +2 −1 .gitignore
  2. +7 −1 lib/batchy/batch.rb
  3. +1 −1 lib/batchy/version.rb
  4. +9 −0 spec/batch_spec.rb
View
@@ -1,2 +1,3 @@
Gemfile.lock
-pkg
+pkg
+*swp
View
@@ -117,7 +117,13 @@ def error
return err if err.blank?
backtrace = read_attribute(:backtrace)
- err.set_backtrace(backtrace)
+ if err.respond_to?(:set_backtrace)
+ err.set_backtrace(backtrace)
+ else
+ def err.backtrace
+ nil
+ end
+ end
err
end
View
@@ -1,3 +1,3 @@
module Batchy
- VERSION = "0.2.3"
+ VERSION = "0.2.4"
end
View
@@ -137,6 +137,15 @@
@batch.error.backtrace.should == backtrace
end
+ it 'should be able to handle a string in the error field' do
+ @batch.start
+ @batch.error = "This is an error"
+ @batch.finish!
+
+ @batch.error.should == "This is an error"
+ @batch.error.backtrace.should be_nil
+ end
+
describe 'parents' do
it 'should set its parent' do
child = FactoryGirl.create(:batch)

0 comments on commit d74bf9a

Please sign in to comment.