Sha256: 3cba7cbd31b1e970879bd59db494379f107bb2f8af56263241e602f7175ac282
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) class TestConnectionApps < Faraday::TestCase class TestAdapter def initialize(app) @app = app end def call(env) [200, {}, env[:test]] end end class TestMiddleWare def initialize(app) @app = app end def call(env) env[:test] = 'hi' @app.call(env) end end before do @conn = Faraday::Connection.new do |b| b.use TestMiddleWare b.use TestAdapter end end describe "#builder" do it "is built from Faraday::Connection constructor" do assert_kind_of Faraday::Builder, @conn.builder assert_equal 3, @conn.builder.handlers.size end it "adds middleware to the Builder stack" do assert_kind_of TestMiddleWare, @conn.builder.handlers[2].call(nil) assert_kind_of TestAdapter, @conn.builder.handlers[1].call(nil) end end describe "#to_app" do it "returns rack-compatible object" do assert @conn.to_app.respond_to?(:call) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
faraday-0.2.3 | test/connection_app_test.rb |
faraday-0.2.2 | test/connection_app_test.rb |
faraday-0.2.1 | test/connection_app_test.rb |
faraday-0.2.0 | test/connection_app_test.rb |