lib/hexx-rspec.rb in hexx-rspec-0.4.2 vs lib/hexx-rspec.rb in hexx-rspec-0.5.1

- old
+ new

@@ -4,13 +4,53 @@ require "rake" require "rspec" require "thor" require "yaml" -# Shared namespace for the Hexx-based gems +require_relative "hexx-rspec/initializers" +require_relative "hexx-rspec/install" +require_relative "hexx-rspec/tasks" +require_relative "hexx-rspec/metrics/base" +require_relative "hexx-rspec/metrics/simplecov" + module Hexx - require_relative "hexx/rspec/version" - require_relative "hexx/rspec" - require_relative "../config/initializer.rb" + module RSpec + + # Wraps calls to system + # + # @param [#to_s] string + # + # @return [undefined] + # + def self.[](string) + system(string) + fail "finished with status #{$?.exitstatus}" unless $?.success? + end + + # Loads coverage metric in a given scope + # + # Checks if a corresponding environment is set + # + # @example + # # spec/spec_helper.rb + # Hexx::RSpec.load_metrics_for(self) + # + # @param [Object] scope + # + # @return [self] + def self.load_metrics_for(scope) + return unless ENV["USE_SIMPLECOV"] && (RUBY_ENGINE == "ruby") + scope.instance_eval { Metrics::SimpleCov.run } + end + + # Installs gem-specific rake tasks + # + # @return [undefined] + # + def self.install_tasks + Tasks.install + end + + end # module RSpec end # module Hexx