Sha256: dd59982a4572689ff34ad44fa989733d75d29ab143530536fc080cd0eef53c71

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 Bytes

Contents

# Reset singleton
# http://blog.ardes.com/2006/12/11/testing-singletons-with-ruby

require "singleton"

class << Singleton

  def included_with_reset(klass)

    included_without_reset(klass)

    class << klass

      def reset_instance
        Singleton.send :__init__, self
        self
      end

    end

  end

  alias_method :included_without_reset, :included

  alias_method :included, :included_with_reset

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
callisto-0.9.1 spec/support/singleton.rb
callisto-0.9 spec/support/singleton.rb