test/test_app.rb in newark-0.0.5 vs test/test_app.rb in newark-0.0.6
- old
+ new
@@ -8,10 +8,22 @@
end
get '/upcaser' do
upcase(params[:name])
end
+
+ get '/hello1' do
+ hello
+ end
+
+ get '/hello2', :hello
+
+ private
+
+ def hello
+ 'Hello'
+ end
end
class TestApp < Minitest::Unit::TestCase
include Rack::Test::Methods
@@ -23,7 +35,24 @@
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 '/'
+ # refute last_response.ok?
+ # assert_equal 403, last_response.status
+ # assert_equal '', last_response.body
+ # end
end