Skip to content

Instantly share code, notes, and snippets.

@citrus
Created June 3, 2011 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save citrus/1005745 to your computer and use it in GitHub Desktop.
Save citrus/1005745 to your computer and use it in GitHub Desktop.
errors!
1) Error:
test: Blog::PostsController should get the blog index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:12:in `block in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
2) Error:
test: published posts should get posts by month. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :month=>3, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:106:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
3) Error:
test: published posts should get posts by year. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:114:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
4) Error:
test: published posts should paginate posts by day. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :month=>3, :day=>20, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:98:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
5) Error:
test: unpublished posts should not include post in day specific index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :month=>3, :day=>20, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:60:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
6) Error:
test: unpublished posts should not include post in index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:55:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
7) Error:
test: unpublished posts should not include post in month specific index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :month=>3, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:65:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
8) Error:
test: unpublished posts should not include post in search results. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:query=>"totally not published", :controller=>"blog/posts", :action=>"search"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:75:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
9) Error:
test: unpublished posts should not include post in year specific index. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :controller=>"blog/posts"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:70:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
10) Error:
test: with an existing post should find by seo path. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:year=>2011, :month=>6, :day=>3, :id=>"peanut-butter-jelly-time", :controller=>"blog/posts", :action=>"show"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:25:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
11) Error:
test: with an existing post should find by tags. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:query=>"gruyere", :controller=>"blog/posts", :action=>"search"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:37:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
12) Error:
test: with an existing post should not find by tags. (Blog::PostsControllerTest):
ActionController::RoutingError: No route matches {:query=>"some crazy random query", :controller=>"blog/posts", :action=>"search"}
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:406:in `rescue in generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:395:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:453:in `generate'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:143:in `assign_parameters'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:402:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:350:in `get'
/Users/Spencer/RoR/gems/ESSENTIALS/spree_essential_blog/test/functional/posts_controller_test.rb:31:in `block (2 levels) in <class:PostsControllerTest>'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `call'
/Users/Spencer/.rvm/gems/ruby-1.9.2-p180/gems/shoulda-2.11.3/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash'
# relevant routes from `rake routes`
blog_post_date GET /blog/:year(/:month(/:day))(.:format) {:year=>/\d{4}/, :month=>/\d{1,2}/, :day=>/\d{1,2}/, :controller=>"blog/posts", :action=>"index"}
blog_full_post GET /blog/:year/:month/:day/:id(.:format) {:year=>/\d{4}/, :month=>/\d{1,2}/, :day=>/\d{1,2}/, :controller=>"blog/posts", :action=>"show"}
blog_search_posts GET /blog/search/:query(.:format) {:query=>/.*/, :controller=>"blog/posts", :action=>"search"}
archive_blog_posts GET /blog/archive(.:format) {:action=>"archive", :controller=>"blog/posts"}
blog_posts GET /blog(.:format) {:action=>"index", :controller=>"blog/posts"}
POST /blog(.:format) {:action=>"create", :controller=>"blog/posts"}
new_blog_post GET /blog/new(.:format) {:action=>"new", :controller=>"blog/posts"}
edit_blog_post GET /blog/:id/edit(.:format) {:action=>"edit", :controller=>"blog/posts"}
blog_post GET /blog/:id(.:format) {:action=>"show", :controller=>"blog/posts"}
PUT /blog/:id(.:format) {:action=>"update", :controller=>"blog/posts"}
DELETE /blog/:id(.:format) {:action=>"destroy", :controller=>"blog/posts"}
blog_root /blog(.:format) {:controller=>"blog/posts", :action=>"index"}
update_positions_admin_post_images POST /admin/posts/:post_id/images/update_positions(.:format) {:action=>"update_positions", :controller=>"admin/Blog/post_images"}
admin_post_images GET /admin/posts/:post_id/images(.:format) {:action=>"index", :controller=>"admin/Blog/post_images"}
POST /admin/posts/:post_id/images(.:format) {:action=>"create", :controller=>"admin/Blog/post_images"}
new_admin_post_image GET /admin/posts/:post_id/images/new(.:format) {:action=>"new", :controller=>"admin/Blog/post_images"}
edit_admin_post_image GET /admin/posts/:post_id/images/:id/edit(.:format) {:action=>"edit", :controller=>"admin/Blog/post_images"}
admin_post_image GET /admin/posts/:post_id/images/:id(.:format) {:action=>"show", :controller=>"admin/Blog/post_images"}
PUT /admin/posts/:post_id/images/:id(.:format) {:action=>"update", :controller=>"admin/Blog/post_images"}
DELETE /admin/posts/:post_id/images/:id(.:format) {:action=>"destroy", :controller=>"admin/Blog/post_images"}
admin_post_products GET /admin/posts/:post_id/products(.:format) {:action=>"index", :controller=>"admin/Blog/post_products"}
POST /admin/posts/:post_id/products(.:format) {:action=>"create", :controller=>"admin/Blog/post_products"}
new_admin_post_product GET /admin/posts/:post_id/products/new(.:format) {:action=>"new", :controller=>"admin/Blog/post_products"}
edit_admin_post_product GET /admin/posts/:post_id/products/:id/edit(.:format) {:action=>"edit", :controller=>"admin/Blog/post_products"}
admin_post_product GET /admin/posts/:post_id/products/:id(.:format) {:action=>"show", :controller=>"admin/Blog/post_products"}
PUT /admin/posts/:post_id/products/:id(.:format) {:action=>"update", :controller=>"admin/Blog/post_products"}
DELETE /admin/posts/:post_id/products/:id(.:format) {:action=>"destroy", :controller=>"admin/Blog/post_products"}
admin_posts GET /admin/posts(.:format) {:action=>"index", :controller=>"admin/Blog/posts"}
POST /admin/posts(.:format) {:action=>"create", :controller=>"admin/Blog/posts"}
new_admin_post GET /admin/posts/new(.:format) {:action=>"new", :controller=>"admin/Blog/posts"}
edit_admin_post GET /admin/posts/:id/edit(.:format) {:action=>"edit", :controller=>"admin/Blog/posts"}
admin_post GET /admin/posts/:id(.:format) {:action=>"show", :controller=>"admin/Blog/posts"}
PUT /admin/posts/:id(.:format) {:action=>"update", :controller=>"admin/Blog/posts"}
DELETE /admin/posts/:id(.:format) {:action=>"destroy", :controller=>"admin/Blog/posts"}
class Blog::PostsController < Spree::BaseController
helper :products
before_filter :get_sidebar, :only => [:index, :search, :show]
def index
@posts_by_month = Post.live.limit(50).group_by { |post| post.posted_at.strftime("%B %Y") }
scope = Post.live
if params[:year].present?
year = params[:year].to_i
month = 1
day = 1
if has_month = params[:month].present?
if has_day = params[:day].present?
day = params[:day].to_i
end
month = params[:month].to_i
end
start = Date.new(year, month, day)
stop = start + 1.year
if has_month
stop = start + 1.month
if has_day
stop = start + 1.day
end
end
scope = scope.where("posted_at >= ? AND posted_at <= ?", start, stop)
end
@posts = scope.paginate(:page => params[:page], :per_page => Post.per_page)
end
def search
query = params[:query].gsub(/%46/, '.')
@posts = Post.live.tagged_with(query).paginate(:page => params[:page], :per_page => Post.per_page)
get_tags
render :template => 'blog/posts/index'
end
def show
@post = Post.live.includes(:tags, :images, :products).find_by_path(params[:id]) rescue nil
return redirect_to archive_posts_path unless @post
end
def archive
@posts = Post.live.all
end
def get_sidebar
@archive_posts = Post.live.limit(10)
get_tags
end
def get_tags
@tags = Post.live.tag_counts.order('count DESC').limit(25)
end
end
require 'test_helper'
class Blog::PostsControllerTest < ActionController::TestCase
def setup
Post.destroy_all
end
should "get the blog index" do
get :index
assert_not_nil assigns(:posts)
assert_not_nil assigns(:posts_by_month)
assert_response :success
end
context "with an existing post" do
setup do
@post = Factory.create(:post, :tag_list => "gruyere, emmentaler, fondue")
end
should "find by seo path" do
get :show, :year => @post.year, :month => @post.month, :day => @post.day, :id => @post.to_param
assert_not_nil assigns(:post)
assert_response :success
end
should "not find by tags" do
get :search, :query => "some crazy random query"
assert_equal 0, assigns(:posts).length
assert_response :success
end
should "find by tags" do
get :search, :query => "gruyere"
assert_equal 1, assigns(:posts).length
assert_equal @post, assigns(:posts).first
assert_response :success
end
end
context "unpublished posts" do
setup do
@tags = "totally not published"
@date = DateTime.parse("2011/3/20 16:00")
@post = Factory.create(:post, :posted_at => @date, :tag_list => @tags, :live => false)
end
should "not include post in index" do
get :index
assert !assigns(:posts).include?(@post)
end
should "not include post in day specific index" do
get :index, :year => @post.year, :month => @post.month, :day => @post.day
assert !assigns(:posts).include?(@post)
end
should "not include post in month specific index" do
get :index, :year => @post.year, :month => @post.month
assert !assigns(:posts).include?(@post)
end
should "not include post in year specific index" do
get :index, :year => @post.year
assert !assigns(:posts).include?(@post)
end
should "not include post in search results" do
get :search, :query => @tags
assert !assigns(:posts).include?(@post)
end
end
context "published posts" do
setup do
@date = DateTime.parse("2011/3/20 16:00")
@post = Factory.create(:post, :posted_at => @date)
10.times {|i| Factory.create(:post, :title => "Today's Sample Post #{i}", :posted_at => @date) }
10.times {|i| Factory.create(:post, :title => "Last Weeks's Sample Post #{i}", :posted_at => @date - 1.week) }
10.times {|i| Factory.create(:post, :title => "Last Month's Sample Post #{i}", :posted_at => @date - 1.month) }
10.times {|i| Factory.create(:post, :title => "Last Years's Sample Post #{i}", :posted_at => @date - 1.year) }
end
should "assert proper post count" do
assert_equal 41, Post.count
end
should "paginate posts by day" do
get :index, :year => @post.year, :month => @post.month, :day => @post.day
assert_equal 10, assigns(:posts).length
assert_equal 11, assigns(:posts).total_entries
assert_equal 2, assigns(:posts).total_pages
assert_response :success
end
should "get posts by month" do
get :index, :year => @post.year, :month => @post.month
assert_equal 10, assigns(:posts).length
assert_equal 21, assigns(:posts).total_entries
assert_equal 3, assigns(:posts).total_pages
assert_response :success
end
should "get posts by year" do
get :index, :year => @post.year
assert_not_nil assigns(:posts)
assert_equal 10, assigns(:posts).length
assert_equal 31, assigns(:posts).total_entries
assert_equal 4, assigns(:posts).total_pages
assert_response :success
end
end
end
module Blog::PostsHelper
def post_seo_path(post)
full_post_path(post.year, post.month, post.day, post.to_param)
end
def post_seo_url(post)
full_post_url(post.year, post.month, post.day, post.to_param)
end
def post_rss(post)
output = []
post.images.each do |image|
output << image_tag(image.attachment.url, :alt => image.alt)
end
output << post.rendered_body
output.join("\n").html_safe
end
def date_full(date)
date.strftime('%A %B %d, %Y').gsub(/\s0/, ' ')
end
end
Rails.application.routes.draw do
#scope(:module => "Blog") do
namespace :blog do
constraints(
:year => /\d{4}/,
:month => /\d{1,2}/,
:day => /\d{1,2}/
) do
get '/:year(/:month(/:day))' => 'posts#index', :as => :post_date
get '/:year/:month/:day/:id' => 'posts#show', :as => :full_post
end
get '/search/:query', :to => 'posts#search', :as => :search_posts, :query => /.*/
resources :posts, :path => "/" do #, :path => 'blog'
get :archive, :on => :collection
end
root :to => "posts#index"
end
namespace :admin do
scope(:module => "Blog") do
resources :posts do
resources :images, :controller => "post_images" do
collection do
post :update_positions
end
end
resources :products, :controller => "post_products"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment