Sha256: 9c2dcf1571c08bf4a62fe0236e5370c7e0940fa69b97601eb11a4f754495504c
Contents?: true
Size: 983 Bytes
Versions: 22
Compression:
Stored size: 983 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
22 entries across 22 versions & 1 rubygems