Sha256: 818ccc4ccf415ff46cfe4af9d4f565bc807ffbb2af11a7014ad6d102cbefbfef

Contents?: true

Size: 1.28 KB

Versions: 35

Compression:

Stored size: 1.28 KB

Contents

require 'maestrano'
require 'test/unit'
require 'shoulda'
require 'mocha/setup'
require 'timecop'

# Require all helpers
Dir[File.expand_path(File.join(File.dirname(__FILE__),"helpers/**/*.rb"))].each {|f| require f}

# Monkeypath request methods
module Maestrano
  module API
    module Operation
      module Base
        @mock_rest_client = nil

        def self.mock_rest_client=(mock_client)
          @mock_rest_client = mock_client
        end

        def self.execute_request(opts)
          get_params = (opts[:headers] || {})[:params]
          post_params = opts[:payload]
          case opts[:method]
          when :get then @mock_rest_client.get opts[:url], get_params, post_params
          when :put then @mock_rest_client.put opts[:url], get_params, post_params
          when :post then @mock_rest_client.post opts[:url], get_params, post_params
          when :delete then @mock_rest_client.delete opts[:url], get_params, post_params
          end
        end
      end
    end
  end
end 

class Test::Unit::TestCase
  setup do
    @api_mock = mock('api_mock')
    Maestrano::API::Operation::Base.mock_rest_client = @api_mock
    Maestrano.configure do |config|
      config.app_id = "app-1"
      config.api_key = "g15354F34f3x5z"
      config.environment = 'production'
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
maestrano-1.0.6 test/test_helper.rb
maestrano-1.0.5 test/test_helper.rb
maestrano-1.0.4 test/test_helper.rb
maestrano-1.0.3 test/test_helper.rb
maestrano-1.0.2 test/test_helper.rb
maestrano-1.0.1 test/test_helper.rb
maestrano-1.0.0 test/test_helper.rb
maestrano-1.0.0.pre.RC9 test/test_helper.rb
maestrano-1.0.0.pre.RC8 test/test_helper.rb
maestrano-1.0.0.pre.RC7 test/test_helper.rb
maestrano-1.0.0.pre.RC6 test/test_helper.rb
maestrano-1.0.0.pre.RC5 test/test_helper.rb
maestrano-1.0.0.pre.RC4 test/test_helper.rb
maestrano-1.0.0.pre.RC3 test/test_helper.rb
maestrano-1.0.0.pre.RC2 test/test_helper.rb
maestrano-1.0.0.pre.RC1 test/test_helper.rb
maestrano-0.12.5 test/test_helper.rb
maestrano-0.12.4 test/test_helper.rb
maestrano-0.12.3 test/test_helper.rb
maestrano-0.12.2 test/test_helper.rb