Sha256: 07fa4bada1c1cea469eb6bc538ad54bae369929b5d4e255c9be5d18f9effeced

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'fitting/version'
require 'fitting/configuration'
require 'fitting/matchers/response_matcher'
require 'fitting/documentation'
require 'fitting/storage/responses'
require 'fitting/railtie' if defined?(Rails)

module Fitting
  class << self
    def configure
      yield configuration
    end

    def configuration
      @configuration ||= Configuration.craft
    end

    def statistics
      responses = Fitting::Storage::Responses.new

      RSpec.configure do |config|
        config.after(:each, type: :controller) do
          responses.add(response, inspect)
        end

        config.after(:suite) do
          responses.statistics.save
        end
      end
    end

    def save_test_data
      responses = Fitting::Storage::Responses.new

      RSpec.configure do |config|
        config.after(:each, type: :controller) do
          responses.add(response, inspect)
        end

        config.after(:suite) do
          responses.tests.save
        end
      end
    end
  end

  def self.loaded_tasks=(val)
    @loaded_tasks = val
  end

  def self.loaded_tasks
    @loaded_tasks
  end

  def self.load_tasks
    return if loaded_tasks
    self.loaded_tasks = true

    Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake|
      load rake
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fitting-2.8.1 lib/fitting.rb
fitting-2.8.0 lib/fitting.rb
fitting-2.7.2 lib/fitting.rb