From 875b2f1ab17e837445c3996e33cdaeb0efef1740 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 8 Aug 2011 21:21:18 -0400 Subject: [PATCH] adding the silly hello world controller --- .../015/01/status/app/controllers/hello_controller.rb | 5 +++++ cookbook/015/01/status/app/helpers/hello_helper.rb | 2 ++ cookbook/015/01/status/app/views/hello/world.html.erb | 11 +++++++++++ cookbook/015/01/status/config/routes.rb | 2 ++ .../status/test/functional/hello_controller_test.rb | 9 +++++++++ .../01/status/test/unit/helpers/hello_helper_test.rb | 4 ++++ 6 files changed, 33 insertions(+) create mode 100644 cookbook/015/01/status/app/controllers/hello_controller.rb create mode 100644 cookbook/015/01/status/app/helpers/hello_helper.rb create mode 100644 cookbook/015/01/status/app/views/hello/world.html.erb create mode 100644 cookbook/015/01/status/test/functional/hello_controller_test.rb create mode 100644 cookbook/015/01/status/test/unit/helpers/hello_helper_test.rb diff --git a/cookbook/015/01/status/app/controllers/hello_controller.rb b/cookbook/015/01/status/app/controllers/hello_controller.rb new file mode 100644 index 0000000..6d366c7 --- /dev/null +++ b/cookbook/015/01/status/app/controllers/hello_controller.rb @@ -0,0 +1,5 @@ +class HelloController < ApplicationController + def world + end + +end diff --git a/cookbook/015/01/status/app/helpers/hello_helper.rb b/cookbook/015/01/status/app/helpers/hello_helper.rb new file mode 100644 index 0000000..b498006 --- /dev/null +++ b/cookbook/015/01/status/app/helpers/hello_helper.rb @@ -0,0 +1,2 @@ +module HelloHelper +end diff --git a/cookbook/015/01/status/app/views/hello/world.html.erb b/cookbook/015/01/status/app/views/hello/world.html.erb new file mode 100644 index 0000000..437bdda --- /dev/null +++ b/cookbook/015/01/status/app/views/hello/world.html.erb @@ -0,0 +1,11 @@ +

Several increasingly silly ways of displaying “Hello world!”:

+ +

<%= "Hello world!" %>

+

<%= "Hello" + " world!" %>

+

<%= w = "world" + "Hello #{w}!" %>

+

<%= 'H' + ?e.chr + ('l' * 2) %><%= ('o word!').gsub('d', 'ld')%>

+ +<% hello = "Hello" %> +<% world = "world!" %> +<%= hello %> <%= world %> diff --git a/cookbook/015/01/status/config/routes.rb b/cookbook/015/01/status/config/routes.rb index c1a10d8..d35b1d2 100644 --- a/cookbook/015/01/status/config/routes.rb +++ b/cookbook/015/01/status/config/routes.rb @@ -1,4 +1,6 @@ Status::Application.routes.draw do + get "hello/world" + get "status/index" # The priority is based upon order of creation: diff --git a/cookbook/015/01/status/test/functional/hello_controller_test.rb b/cookbook/015/01/status/test/functional/hello_controller_test.rb new file mode 100644 index 0000000..b0b489f --- /dev/null +++ b/cookbook/015/01/status/test/functional/hello_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class HelloControllerTest < ActionController::TestCase + test "should get world" do + get :world + assert_response :success + end + +end diff --git a/cookbook/015/01/status/test/unit/helpers/hello_helper_test.rb b/cookbook/015/01/status/test/unit/helpers/hello_helper_test.rb new file mode 100644 index 0000000..df82ec0 --- /dev/null +++ b/cookbook/015/01/status/test/unit/helpers/hello_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class HelloHelperTest < ActionView::TestCase +end