lib/minitest/hyper_plugin.rb in minitest-hyper-0.1.0 vs lib/minitest/hyper_plugin.rb in minitest-hyper-0.2.0
- old
+ new
@@ -21,31 +21,41 @@
end
end
module Hyper
GEM_DIR = File.join(File.dirname(__FILE__), "../..")
- WORKING_DIR = Dir.pwd
- REPORTS_DIR = File.join(WORKING_DIR, "test/reports/hyper")
- REPORT_FILE = File.join(REPORTS_DIR, "index.html")
-
TEMPLATE_DIR = File.join(GEM_DIR, "lib/templates")
CSS_TEMPLATE = File.join(TEMPLATE_DIR, "hyper.css")
HTML_TEMPLATE = File.join(TEMPLATE_DIR, "index.html.erb")
-
- VERSION = "0.1.0"
+ VERSION = "0.2.0"
+
@@enabled = false
-
+
def self.enabled?
@@enabled
end
def self.enable!
@@enabled = true
end
- def config(options)
- @options = options
+ def self.report_dirname
+ project_root = if defined?(Rails) && defined?(Rails.root)
+ Rails.root
+ else
+ Dir.pwd
+ end
+
+ if Dir.exist?(File.join(project_root, "spec"))
+ File.join(project_root, "spec/reports/hyper")
+ else
+ File.join(project_root, "test/reports/hyper")
+ end
+ end
+
+ def self.report_filename
+ File.join(report_dirname, "index.html")
end
end
end