working through 15.13

This commit is contained in:
Dan Buch 2011-08-10 22:06:36 -04:00
parent feaea1636c
commit aac108a50d
6 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,8 @@
require 'sha1'
class ListController < ApplicationController
def index
@list = [1, "string", :symbol, ['list']]
end
end

View File

@ -0,0 +1,2 @@
module ListHelper
end

View File

@ -0,0 +1,6 @@
<ul style="font-family:monospace;">
<% @list.each_with_index do |item, i| %>
<li class="<%= i % 2 == 0 ? 'even' : 'odd' %>"><%= i %>:
<%= SHA1.new(item.id.to_s) %></li>
<% end %>
</ul>

View File

@ -1,4 +1,6 @@
Hodgepodge::Application.routes.draw do
get "list/index"
get "foo/count"
get "foo/index"
get "foo/pretty"

View File

@ -0,0 +1,9 @@
require 'test_helper'
class ListControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class ListHelperTest < ActionView::TestCase
end