From c16c1361d3f7613fae7fd8c543b4bd8edbedbbd8 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 9 Aug 2011 06:33:51 -0400 Subject: [PATCH] working through 15.3 --- .../015/hodgepodge/app/controllers/foo_controller.rb | 5 +++++ .../015/hodgepodge/app/controllers/status_controller.rb | 1 + cookbook/015/hodgepodge/app/helpers/foo_helper.rb | 2 ++ cookbook/015/hodgepodge/app/views/foo/index.html.erb | 2 ++ .../hodgepodge/app/views/layouts/application.html.erb | 2 +- cookbook/015/hodgepodge/config/routes.rb | 2 ++ .../hodgepodge/test/functional/foo_controller_test.rb | 9 +++++++++ .../015/hodgepodge/test/unit/helpers/foo_helper_test.rb | 4 ++++ 8 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 cookbook/015/hodgepodge/app/controllers/foo_controller.rb create mode 100644 cookbook/015/hodgepodge/app/helpers/foo_helper.rb create mode 100644 cookbook/015/hodgepodge/app/views/foo/index.html.erb create mode 100644 cookbook/015/hodgepodge/test/functional/foo_controller_test.rb create mode 100644 cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb diff --git a/cookbook/015/hodgepodge/app/controllers/foo_controller.rb b/cookbook/015/hodgepodge/app/controllers/foo_controller.rb new file mode 100644 index 0000000..392a279 --- /dev/null +++ b/cookbook/015/hodgepodge/app/controllers/foo_controller.rb @@ -0,0 +1,5 @@ +class FooController < ApplicationController + def index + end + +end diff --git a/cookbook/015/hodgepodge/app/controllers/status_controller.rb b/cookbook/015/hodgepodge/app/controllers/status_controller.rb index 7f0ffeb..f15057f 100644 --- a/cookbook/015/hodgepodge/app/controllers/status_controller.rb +++ b/cookbook/015/hodgepodge/app/controllers/status_controller.rb @@ -1,5 +1,6 @@ class StatusController < ApplicationController def index + @title = "System Status" time = Time.now @time = time @ps = `ps aux` diff --git a/cookbook/015/hodgepodge/app/helpers/foo_helper.rb b/cookbook/015/hodgepodge/app/helpers/foo_helper.rb new file mode 100644 index 0000000..c3ad23b --- /dev/null +++ b/cookbook/015/hodgepodge/app/helpers/foo_helper.rb @@ -0,0 +1,2 @@ +module FooHelper +end diff --git a/cookbook/015/hodgepodge/app/views/foo/index.html.erb b/cookbook/015/hodgepodge/app/views/foo/index.html.erb new file mode 100644 index 0000000..6bdfb2d --- /dev/null +++ b/cookbook/015/hodgepodge/app/views/foo/index.html.erb @@ -0,0 +1,2 @@ +

Foo#index

+

Find me in app/views/foo/index.html.erb

diff --git a/cookbook/015/hodgepodge/app/views/layouts/application.html.erb b/cookbook/015/hodgepodge/app/views/layouts/application.html.erb index d27351b..caf0829 100644 --- a/cookbook/015/hodgepodge/app/views/layouts/application.html.erb +++ b/cookbook/015/hodgepodge/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - Hodgepodge + My Website - <%= @title %> <%= yield %> diff --git a/cookbook/015/hodgepodge/config/routes.rb b/cookbook/015/hodgepodge/config/routes.rb index 654829d..ce31f9e 100644 --- a/cookbook/015/hodgepodge/config/routes.rb +++ b/cookbook/015/hodgepodge/config/routes.rb @@ -1,4 +1,6 @@ Hodgepodge::Application.routes.draw do + get "foo/index" + # The priority is based upon order of creation: # first created -> highest priority. diff --git a/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb b/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb new file mode 100644 index 0000000..289ffba --- /dev/null +++ b/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class FooControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb b/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb new file mode 100644 index 0000000..f4454c1 --- /dev/null +++ b/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class FooHelperTest < ActionView::TestCase +end