Sha256: 49d4f5b36715e33c72db1d157da1465b4c1ee254ff071591844f9f6c51fd0ef1

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

require 'savon'

def mock_controller(&block)
  # You are not expected to understand this.
  class <<(mock = lambda do
    Class.new(ApplicationController) do
      include WashOut::SOAP

      class_exec &block

      def self.controller_path
        "api"
      end

      def default_url_options
        { :controller => 'api' }
      end
    end
  end)
    def invoke
      @self ||= call
    end

    def method_missing(method, *args)
      invoke.send method, *args
    end

    def use!
      $controller = invoke
    end
  end

  mock
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wash_out-0.2.1 spec/support/mock_controller.rb
wash_out-0.2.0 spec/support/mock_controller.rb