Skip to content

Commit

Permalink
add missing dry scaffold rake include
Browse files Browse the repository at this point in the history
add favico test
  • Loading branch information
Glenn Roberts committed Jun 25, 2010
1 parent ae6f80b commit 5a762f3
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 51 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

require 'dry_scaffold/tasks'
4 changes: 2 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# this is separate from StaticPageController since we use nested layouts
# which means the index page can have its own unique layout
class HomeController < ApplicationController

def index
end

end
3 changes: 0 additions & 3 deletions app/controllers/static_page_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
class StaticPageController < ApplicationController
PAGES = %w[about] #allowable (non-index) pages rendered by show action

def show
render :action => params[:page]
end

end
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
config.gem "cucumber", :version => "0.6.4", :lib => false
config.gem "cucumber-rails", :version => "0.3.0", :lib => false

config.gem 'dry_scaffold', :version => "0.3.8", :lib => false
config.gem 'dry_scaffold', :version => ">= 0.3.8", :lib => false
# Handy for debugging E.g. script/server --debugger
config.gem "ruby-debug"
config.gem "rails-footnotes"
Expand Down
50 changes: 5 additions & 45 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
ActionController::Routing::Routes.draw do |map|
map.static_page ':page',
:controller => 'static_page',
:action => 'show',
:page => Regexp.new(%w[about contact].join('|'))

map.root :controller => 'home' #a replacement for public/index.html
# DRY up the static page controller
map.home ':page', :controller => 'static_page', :action => 'show', :page => Regexp.new(StaticPageController::PAGES.join('|'))

# The priority is based upon order of creation: first created -> highest priority.

# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action

# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)

# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products

# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller

# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end

# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end

# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"

# See how all your routes lay out with "rake routes"

# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
map.root :controller => 'home', :action => 'index' # a replacement for public/index.html, with unique layout
end
15 changes: 15 additions & 0 deletions spec/controllers/home_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require File.dirname(__FILE__) + '/../spec_helper'

describe HomeController do
integrate_views

it "index action should render index template" do
get :index
response.should render_template(:index)
end

it "should show a favicon" do
pending
lambda { get '/images/favico.ico' }.should_not raise_error ActionController::RoutingError
end
end
5 changes: 5 additions & 0 deletions spec/helpers/home_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require File.dirname(__FILE__) + '/../spec_helper'

describe HomeHelper do

end
10 changes: 10 additions & 0 deletions spec/views/home/index.html.haml_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/home/index.html.haml" do
include HomeHelper

it "should render happily" do
pending
render
end
end

0 comments on commit 5a762f3

Please sign in to comment.