Sha256: 2b98a0fc619354103786423ba6af85e36a780c89a8ae7a9a256c92d25a501529

Contents?: true

Size: 418 Bytes

Versions: 2

Compression:

Stored size: 418 Bytes

Contents

module Mockumentary
  module ActiveRecord
    def mock_class
      @mock_class ||= discover_mock_class!
    end

    def discover_mock_class!
      Mockery.classes.detect {|c| c.ar_class == self } || Mockery.generate(self)
    end

    def mock(opts={})
      mock_class.mock(opts)
    end

    def mock!(opts={})
      mock_class.mock!(opts)
    end

    def mew(opts={})
      mock_class.new(opts)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mockumentary-0.2.1 lib/mockumentary/active_record.rb
mockumentary-0.2.0 lib/mockumentary/active_record.rb