lib/assert/view.rb in assert-2.4.0 vs lib/assert/view.rb in assert-2.5.0
- old
+ new
@@ -4,19 +4,21 @@
# this method is used to bring in custom user-specific views
# require views by passing either a full path to the view ruby file
# or passing the name of a view installed in ~/.assert/views
- def self.require_user_view(view)
- views_file = File.join(Assert.config.user_test_dir, 'views', view, 'lib', view)
+ def self.require_user_view(view_name)
+ views_file = File.expand_path(
+ File.join("#{ENV['HOME']}/.assert/views", view_name, 'lib', view_name)
+ )
- if File.exists?(view) || File.exists?(view+'.rb')
- require view
- elsif File.exists?(views_file+'.rb')
+ if File.exists?(view_name) || File.exists?(view_name + '.rb')
+ require view_name
+ elsif File.exists?(views_file + '.rb')
require views_file
else
- msg = "[WARN] Can't find or require #{view.inspect} view."
- msg << " Did you install it in `~/.assert/views`?" if !view.match(/\A\//)
+ msg = "[WARN] Can't find or require #{view_name.inspect} view."
+ msg << " Did you install it in `~/.assert/views`?" if !view_name.match(/\A\//)
warn msg
end
end
end