spec/spec_helper.rb in lorj-1.0.12 vs spec/spec_helper.rb in lorj-1.0.13
- old
+ new
@@ -30,5 +30,59 @@
end
else
def stop
end
end
+
+require 'lorj'
+
+# Define some spec addon
+module PrcLib
+ module_function
+
+ # Attribute app_name
+ #
+ # app_name is set to 'lorj' if not set.
+ #
+ def spec_cleanup
+ instance_variables.each do |v|
+ # @lib_path is set by require 'lorj'. We should never update it.
+ # @core_level is set by require 'lorj'. We should never update it.
+ next if [:'@lib_path', :'@core_level'].include?(v)
+ instance_variable_set(v, nil)
+ end
+ end
+
+ def to_s
+ a = {}
+ instance_variables.each do |v|
+ a[v] = instance_variable_get(v)
+ end
+ a
+ end
+end
+
+# Define some spec addon
+module Lorj
+ module_function
+
+ # Attribute app_name
+ #
+ # app_name is set to 'lorj' if not set.
+ #
+ def spec_cleanup
+ instance_variables.each do |v|
+ # @lib_path is set by require 'lorj'. We should never update it.
+ # @core_level is set by require 'lorj'. We should never update it.
+ next if [:'@lib_path', :'@core_level'].include?(v)
+ instance_variable_set(v, nil)
+ end
+ end
+
+ def to_s
+ a = {}
+ instance_variables.each do |v|
+ a[v] = instance_variable_get(v)
+ end
+ a
+ end
+end