app/models/test_case.rb in sw2at-ui-0.0.6 vs app/models/test_case.rb in sw2at-ui-0.0.7

- old
+ new

@@ -13,20 +13,30 @@ started_at: rspec_example.metadata[:execution_result].started_at, run_time: rspec_example.metadata[:execution_result].run_time }.merge!(revision_opts).merge!(extras) if rspec_example.exception - data[:exception] = { - message: rspec_example.exception.message, - backtrace: rspec_example.exception.backtrace, - } + data[:exception] = extract_exception(rspec_example) end if rspec_example.respond_to?(:swat_extras) data.merge!(swat_extras: rspec_example.swat_extras) end create(data) + end + + private + + def extract_exception(rspec_example) + trace = rspec_example.exception.backtrace + if defined?(Rails) + trace = ([ trace.first ] + trace.select{|x| x.include?(Rails.root.to_s) } + [ trace.last ]).uniq + end + { + message: rspec_example.exception.message, + backtrace: trace, + } end end end