Class: Lanes::ApiTestCase

Inherits:
TestCase
  • Object
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

#appObject



57
58
59
# File 'lib/lanes/spec_helper.rb', line 57

def app
    Lanes::API::Root.new
end

#assert_okObject



83
84
85
# File 'lib/lanes/spec_helper.rb', line 83

def assert_ok
    assert last_response.ok?, "Request failed with #{last_response.status}"
end

#json_bodyObject



61
62
63
# File 'lib/lanes/spec_helper.rb', line 61

def json_body
    Hashie::Mash.new Oj.load( last_response.body )
end

#json_dataObject



65
66
67
# File 'lib/lanes/spec_helper.rb', line 65

def json_data
    json_body['data']
end

#login!(user = admin) ⇒ Object



79
80
81
# File 'lib/lanes/spec_helper.rb', line 79

def login!(user=admin)
    @current_user = user
end

#refute_okObject



86
87
88
# File 'lib/lanes/spec_helper.rb', line 86

def refute_ok
    refute last_response.ok?, "Request succeeded with status #{last_response.status}, expected non-2XX"
end