test/excon/addressable_test.rb in excon-addressable-0.4.0 vs test/excon/addressable_test.rb in excon-addressable-0.4.1

- old
+ new

@@ -14,10 +14,12 @@ Excon.stub({ path: '/' }, body: 'index') Excon.stub({ path: '/hello' }, body: 'world') Excon.stub({ path: '/hello', query: 'message=world' }, body: 'hi!') Excon.stub({ path: '/hello', query: 'a=b&c=d' }, body: 'earth') Excon.stub({ path: '/world' }, body: 'universe') + Excon.stub({ path: '/foo' }, headers: { 'Location' => '/bar' }, body: 'no', status: 301) + Excon.stub({ path: '/bar' }, body: 'ok!', status: 200) end def test_expand_templated_uri connection = Excon.new('http://www.example.com/{uid}', expand: { uid: 'hello' }) response = connection.get @@ -66,9 +68,18 @@ def test_uri_with_multiple_queries response = Excon.get('https://www.example.com/hello', query: { a: 'b', c: 'd' }) assert_equal 'earth', response.body + end + + def test_uri_with_redirect + response = Excon.get( + 'https://www.example.com/foo', + middlewares: Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower] + ) + + assert_equal 'ok!', response.body end def teardown Excon.stubs.clear end