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, silence_logs
Instance Method Details
#app ⇒ Object
62
63
64
|
# File 'lib/lanes/spec_helper.rb', line 62
def app
Lanes::API::Root.new
end
|
#assert_ok ⇒ Object
88
89
90
|
# File 'lib/lanes/spec_helper.rb', line 88
def assert_ok
assert last_response.ok?, "Request failed with #{last_response.status}"
end
|
#json_body ⇒ Object
66
67
68
|
# File 'lib/lanes/spec_helper.rb', line 66
def json_body
Hashie::Mash.new Oj.load( last_response.body )
end
|
#json_data ⇒ Object
70
71
72
|
# File 'lib/lanes/spec_helper.rb', line 70
def json_data
json_body['data']
end
|
#login!(user = admin) ⇒ Object
84
85
86
|
# File 'lib/lanes/spec_helper.rb', line 84
def login!(user=admin)
@current_user = user
end
|
#refute_ok ⇒ Object
91
92
93
|
# File 'lib/lanes/spec_helper.rb', line 91
def refute_ok
refute last_response.ok?, "Request succeeded with status #{last_response.status}, expected non-2XX"
end
|