Sha256: ac27fea6c7e776434a839d29b3b2058793aa52fc4c82579a89f6a7c7ce312aff

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

module Knapsack
  module Adapters
    class RspecAdapter < BaseAdapter
      def bind_time_tracker
        ::RSpec.configure do |config|
          config.before(:each) do
            Knapsack.tracker.spec_path = RspecAdapter.spec_path
            Knapsack.tracker.start_timer
          end

          config.after(:each) do
            Knapsack.tracker.stop_timer
          end

          config.after(:suite) do
            puts Presenter.global_time
          end
        end
      end

      def bind_report_generator
        ::RSpec.configure do |config|
          config.after(:suite) do
            Knapsack.report.save
            puts Presenter.report_details
          end
        end
      end

      def bind_time_offset_warning
        ::RSpec.configure do |config|
          config.after(:suite) do
            puts Presenter.time_offset_warning
          end
        end
      end

      protected

      def self.spec_path
        ::RSpec.current_example.metadata[:example_group][:file_path]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knapsack-0.1.0 lib/knapsack/adapters/rspec_adapter.rb