Class: ResponseNoBodyMiddleWareTest

Inherits:
Faraday::TestCase show all
Defined in:
test/response_middleware_test.rb

Defined Under Namespace

Classes: NotCalled

Instance Method Summary collapse

Methods inherited from Faraday::TestCase

#capture_warnings, jruby?, rbx?, ssl_mode?, #test_default

Methods included from Faraday::LiveServerConfig

#live_server, #live_server=, #live_server?

Instance Method Details

#setupObject


48
49
50
51
52
53
54
55
56
57
# File 'test/response_middleware_test.rb', line 48

def setup
  @conn = Faraday.new do |b|
    b.response :raise_error
    b.adapter :test do |stub|
      stub.get('not_modified') { [304, nil, nil] }
      stub.get('no_content') { [204, nil, nil] }
    end
  end
  @conn.builder.insert(0, NotCalled)
end

#test_204Object


65
66
67
# File 'test/response_middleware_test.rb', line 65

def test_204
  assert_equal nil, @conn.get('no_content').body
end

#test_304Object


69
70
71
# File 'test/response_middleware_test.rb', line 69

def test_304
  assert_equal nil, @conn.get('not_modified').body
end