Sha256: 87907997bdc6ba61bb7bf7b21a603aa64deb9598b1b548974c0f32d86829e9f2
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'helper' class NameApp include Newark before do if params[:key] && params[:key] != '23' response.status = 403 false end end def upcase(str) str.upcase end get '/upcaser' do upcase(params[:name]) end get '/hello1' do hello end get '/fail' do 'This should not be reached' end get '/hello2', :hello private def hello 'Hello' end end class TestApp < MiniTest::Unit::TestCase include Rack::Test::Methods def app Rack::Lint.new(NameApp.new) end def test_instance_method_access get '/upcaser', { name: 'mike' } assert last_response.ok? assert_equal 'MIKE', last_response.body end def test_alternate_action_invocation get '/hello1' assert last_response.ok? assert_equal 'Hello', last_response.body get '/hello2' assert last_response.ok? assert_equal 'Hello', last_response.body end def test_before_hooks_halting_execution get '/fail', { key: '1234' } refute last_response.ok? assert_equal 403, last_response.status assert_equal '', last_response.body end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
newark-0.0.8 | test/test_app.rb |