Sha256: adf63fda2fa59685e0a499c2e671d9cc1befbeae2a04db6260218f181b6fe021

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

# encoding: utf-8

module Hexx

  # Namespace for the module.
  #
  # @api public
  module RSpec

    require_relative "rspec/system"
    require_relative "rspec/metrics"
    require_relative "rspec/install"

    class << self

      # 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 load_metrics_for(scope)
        return unless ENV["USE_SIMPLECOV"] && (RUBY_ENGINE == "ruby")
        scope.instance_eval { Hexx::RSpec::Metrics::SimpleCov.run }
      end

      # Loads all the necessary rake tasks
      #
      # @example
      #   Hexx::RSpec.install_tasks
      #
      # @return [self]
      def install_tasks
        load_gem_tasks
        load_rspec_tasks
        load_custom_tasks
      end

      private

      def load_gem_tasks
        require "bundler/gem_tasks"
        ::Bundler::GemHelper.install_tasks
      end

      def load_rspec_tasks
        require "rspec/core/rake_task"
        ::RSpec::Core::RakeTask.new(:spec)
      end

      def load_custom_tasks
        tasks = ::File.expand_path "../../tasks/**/*.rake", __FILE__
        ::Dir[tasks].each { |task| load task }
      end

    end # singleton class RSpec

  end # module RSpec

end # module Hexx

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hexx-rspec-0.4.2 lib/hexx/rspec.rb
hexx-rspec-0.4.1 lib/hexx/rspec.rb
hexx-rspec-0.4.0 lib/hexx/rspec.rb
hexx-rspec-0.3.1 lib/hexx/rspec.rb
hexx-rspec-0.3.0 lib/hexx/rspec.rb
hexx-rspec-0.2.2 lib/hexx/rspec.rb