Sha256: 619d5d4074861809c2f05cb6ba311cd9ad0b1bc5036f756c14325fefd813ccfb

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

module ActiveMocker

  class LoadedMocks
    def self.add(mocks_to_add)
      mocks.merge!({mocks_to_add.name => mocks_to_add})
    end

    def self.all
      mocks
    end

    def self.clear_all
      mocks.each { |n, m| m.clear_mock }
    end

    def self.delete_all
      mocks.each { |n, m| m.delete_all }
    end

    def self.reload_all
      mocks.each { |n, m| m.reload }
    end

    def self.mocks
      @@mocks ||= {}
    end

    def self.undefine_all
      mocks.each do |n, m|
        Object.send(:remove_const, n) if Object.const_defined?(:n)
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_mocker-1.3.2 lib/active_mocker/loaded_mocks.rb