Class: Lanes::ApiTestCase
- Inherits:
-
TestCase
- Object
- ActiveSupport::TestCase
- TestCase
- Lanes::ApiTestCase
show all
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/lanes/spec_helper.rb
Constant Summary
Constants included
from Lanes
VERSION
Instance Method Summary
collapse
Methods inherited from TestCase
#admin
Methods included from Lanes
config, configure, env, logger, logger=, logger_debug, redis_connection, silence_logs
Instance Method Details
#app ⇒ Object
65
66
67
|
# File 'lib/lanes/spec_helper.rb', line 65
def app
Lanes::API::Root.new
end
|
#assert_ok ⇒ Object
91
92
93
|
# File 'lib/lanes/spec_helper.rb', line 91
def assert_ok
assert last_response.ok?, "Request failed with #{last_response.status}"
end
|
#json_body ⇒ Object
69
70
71
|
# File 'lib/lanes/spec_helper.rb', line 69
def json_body
Hashie::Mash.new Oj.load( last_response.body )
end
|
#json_data ⇒ Object
73
74
75
|
# File 'lib/lanes/spec_helper.rb', line 73
def json_data
json_body['data']
end
|
#login!(user = admin) ⇒ Object
87
88
89
|
# File 'lib/lanes/spec_helper.rb', line 87
def login!(user=admin)
@current_user = user
end
|
#refute_ok ⇒ Object
94
95
96
|
# File 'lib/lanes/spec_helper.rb', line 94
def refute_ok
refute last_response.ok?, "Request succeeded with status #{last_response.status}, expected non-2XX"
end
|