Sha256: b49e295235eb57fb640f44cdfd66a4911f8d0e4b0ba5f15135409e64a17ea99b

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

module Bogus
  module PublicMethods
    def record_calls_for(name, klass = nil)
      inject.adds_recording.add(name, klass)
    end

    def verify_contract!(fake_name)
      inject.verifies_contracts.verify(fake_name)
    end

    def configure(&block)
      config.tap(&block)
    end

    def config
      inject.configuration
    end

    def reset!
      @injector = Bogus::Injector.new
    end

    def create_stub(*args)
      inject.create_stub(*args)
    end

    def create_mock(*args)
      inject.create_mock(*args)
    end

    def have_received(*args)
      inject.have_received_matcher(*args).method_call
    end

    def fake_for(*args, &block)
      inject.creates_fakes_with_stubbed_methods.create(*args, &block)
    end

    def fake_class(*args)
      inject.fakes_classes.fake(*args)
    end

    def after_each_test
      ensure_all_expectations_satisfied!
      reset_stubbed_methods
      clear_expectations
      reset_overwritten_classes
    end

    def ensure_all_expectations_satisfied!
      doubles = inject.double_tracker.doubles
      inject.ensures_all_interactions_satisfied.ensure_satisfied!(doubles)
    end

    def clear_expectations
      inject.clear_tracked_doubles
    end

    def reset_stubbed_methods
      inject.resets_stubbed_methods.reset_all_doubles
    end

    def reset_overwritten_classes
      inject.resets_overwritten_classes.reset
    end

    def fakes(&block)
      inject.fake_configuration.evaluate(&block)
    end

    def inject
      @injector ||= Bogus::Injector.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bogus-0.0.3.rc.1 lib/bogus/public_methods.rb