Class: Skink::RackTestClient

Inherits:
Client::Base show all
Includes:
Rack::Test::Methods
Defined in:
lib/skink/rack_test_client/rack_test_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Client::Base

#connect, #method_missing, #options, #patch, #trace

Methods included from Client::Utils

#normalize_header_name

Constructor Details

#initialize(rack_app) ⇒ RackTestClient

Returns a new instance of RackTestClient.



13
14
15
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 13

def initialize(rack_app)
  @app = rack_app
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Skink::Client::Base

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 11

def app
  @app
end

#last_responseObject (readonly)

Returns the value of attribute last_response.



11
12
13
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 11

def last_response
  @last_response
end

Instance Method Details

#delete(path) ⇒ Object



45
46
47
48
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 45

def delete(path)
  resp = super path
  @last_response = RackTestResponse.new resp
end

#get(path) ⇒ Object



30
31
32
33
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 30

def get(path)
  resp = super path
  @last_response = RackTestResponse.new resp
end

#head(path) ⇒ Object



25
26
27
28
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 25

def head(path)
  resp = super path
  @last_response = RackTestResponse.new resp
end

#post(path, body = nil) ⇒ Object



35
36
37
38
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 35

def post(path, body = nil)
  resp = super(path, body)
  @last_response = RackTestResponse.new resp
end

#put(path, body) ⇒ Object



40
41
42
43
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 40

def put(path, body)
  resp = super(path, body)
  @last_response = RackTestResponse.new resp
end

#responseObject



50
51
52
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 50

def response
  last_response
end

#with_basic_auth(user_name, password, realm = nil) ⇒ Object



17
18
19
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 17

def with_basic_auth(user_name, password, realm = nil)
  authorize(user_name, password)
end

#with_header(name, value) ⇒ Object



21
22
23
# File 'lib/skink/rack_test_client/rack_test_client.rb', line 21

def with_header(name, value)
  header(name, value)
end