Sha256: d16d4e5e6b89d05284ca9bdd95e7789b95ac1955374b870e22c1eb5fe3d88cee

Contents?: true

Size: 980 Bytes

Versions: 34

Compression:

Stored size: 980 Bytes

Contents

class TestClientPlugin < Test::Unit::TestCase
  def setup
    stub(Yao.config).debug { false }
    stub(Yao.config).debug_record_response { false }
  end

  def teardown
    Yao.config.set :client_generator, :default
  end

  def test_raise_invalid_name
    e = nil
    begin
      Yao.config.set :client_generator, :nonexist
    rescue => e
    end

    assert { e.is_a? StandardError }
    assert { e.message == "Invalid client_generator name :nonexist.\nNote: name must be a Symbol" }
  end

  class ::Yao::Plugins::TestCustomClientGenerator
    def call(f, t)
      f.response :xml, content_type: /\/xml$/
    end
    ::Yao::Plugins.register self, type: :client_generator, name: :test_custom
  end

  def test_gen_client_with_custom
    Yao.config.set :client_generator, :test_custom

    cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
    handlers = [
      FaradayMiddleware::ParseXml,
    ]
    assert { cli.builder.handlers == handlers }
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
yao-0.21.0 test/yao/test_client_plugin.rb
yao-0.20.0 test/yao/test_client_plugin.rb
yao-0.19.0 test/yao/test_client_plugin.rb
yao-0.18.0 test/yao/test_client_plugin.rb
yao-0.17.0 test/yao/test_client_plugin.rb
yao-0.16.0 test/yao/test_client_plugin.rb
yao-0.15.0 test/yao/test_client_plugin.rb
yao-0.14.0 test/yao/test_client_plugin.rb
yao-0.13.4 test/yao/test_client_plugin.rb
yao-0.13.3 test/yao/test_client_plugin.rb
yao-0.13.2 test/yao/test_client_plugin.rb
yao-0.13.1 test/yao/test_client_plugin.rb
yao-0.13.0 test/yao/test_client_plugin.rb
yao-0.12.0 test/yao/test_client_plugin.rb
yao-0.11.3 test/yao/test_client_plugin.rb
yao-0.11.2 test/yao/test_client_plugin.rb
yao-0.11.1 test/yao/test_client_plugin.rb
yao-0.11.0 test/yao/test_client_plugin.rb
yao-0.10.1 test/yao/test_client_plugin.rb
yao-0.10.0 test/yao/test_client_plugin.rb