Skip to content

Instantly share code, notes, and snippets.

@jswanner
Forked from citrus/posts_controller.rb
Created June 3, 2011 18:58
Show Gist options
  • Select an option

  • Save jswanner/1006941 to your computer and use it in GitHub Desktop.

Select an option

Save jswanner/1006941 to your computer and use it in GitHub Desktop.

Revisions

  1. jswanner revised this gist Jun 3, 2011. 1 changed file with 11 additions and 13 deletions.
    24 changes: 11 additions & 13 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,15 @@
    # 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"}
    archive_posts GET /blog/archive(.:format) {:controller=>"blog/posts", :action=>"archive"}
    posts GET /blog(.:format) {:controller=>"blog/posts", :action=>"index"}
    POST /blog(.:format) {:controller=>"blog/posts", :action=>"create"}
    new_post GET /blog/new(.:format) {:controller=>"blog/posts", :action=>"new"}
    edit_post GET /blog/:id/edit(.:format) {:controller=>"blog/posts", :action=>"edit"}
    post GET /blog/:id(.:format) {:controller=>"blog/posts", :action=>"show"}
    PUT /blog/:id(.:format) {:controller=>"blog/posts", :action=>"update"}
    DELETE /blog/:id(.:format) {:controller=>"blog/posts", :action=>"destroy"}
    post_date GET /:year(/:month(/:day))(.:format) {:day=>/\d{1,2}/, :controller=>"blog/posts", :month=>/\d{1,2}/, :action=>"index", :year=>/\d{4}/}
    full_post GET /:year/:month/:day/:id(.:format) {:day=>/\d{1,2}/, :controller=>"blog/posts", :month=>/\d{1,2}/, :action=>"show", :year=>/\d{4}/}
    search_posts GET /search/:query(.:format) {:controller=>"blog/posts", :query=>/.*/, :action=>"search"}
    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"}
  2. jswanner revised this gist Jun 3, 2011. 1 changed file with 13 additions and 20 deletions.
    33 changes: 13 additions & 20 deletions routes.rb
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,19 @@
    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"

    resources :blog, :as => 'posts', :module => 'blog', :controller => 'posts' do
    get :archive, :on => :collection
    end

    constraints(
    :year => /\d{4}/,
    :month => /\d{1,2}/,
    :day => /\d{1,2}/
    ) do
    get '/:year(/:month(/:day))' => 'blog/posts#index', :as => :post_date
    get '/:year/:month/:day/:id' => 'blog/posts#show', :as => :full_post
    end

    get '/search/:query', :to => 'blog/posts#search', :as => :search_posts, :query => /.*/

    namespace :admin do
    scope(:module => "Blog") do
  3. @citrus citrus revised this gist Jun 3, 2011. 3 changed files with 38 additions and 14 deletions.
    24 changes: 12 additions & 12 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    # relevant routes from `rake routes`


    post_date GET /blog/:year(/:month)(/:day)(.:format) {:year=>/\d{4}/, :month=>/\d{1,2}/, :day=>/\d{1,2}/, :controller=>"Blog/posts", :action=>"index"}
    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"}
    search_posts GET /blog/search/:query(.:format) {:query=>/.*/, :controller=>"Blog/posts", :action=>"search"}
    archive_posts GET /blog/archive(.:format) {:action=>"archive", :controller=>"Blog/posts"}
    posts GET /blog(.:format) {:action=>"index", :controller=>"Blog/posts"}
    POST /blog(.:format) {:action=>"create", :controller=>"Blog/posts"}
    new_post GET /blog/new(.:format) {:action=>"new", :controller=>"Blog/posts"}
    edit_post GET /blog/:id/edit(.:format) {:action=>"edit", :controller=>"Blog/posts"}
    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_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"}
    24 changes: 24 additions & 0 deletions posts_helper.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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
    4 changes: 2 additions & 2 deletions routes.rb
    Original file line number Diff line number Diff line change
    @@ -14,11 +14,11 @@

    get '/search/:query', :to => 'posts#search', :as => :search_posts, :query => /.*/

    resources :posts do #, :path => 'blog'
    resources :posts, :path => "/" do #, :path => 'blog'
    get :archive, :on => :collection
    end


    root :to => "posts#index"

    end

  4. @citrus citrus revised this gist Jun 3, 2011. No changes.
  5. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions routes.rb
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,25 @@
    Rails.application.routes.draw do

    scope(:module => "Blog") do
    #scope(:module => "Blog") do
    namespace :blog do

    constraints(
    :year => /\d{4}/,
    :month => /\d{1,2}/,
    :day => /\d{1,2}/
    ) do
    get '/blog/:year(/:month)(/:day)' => 'posts#index', :as => :post_date
    get '/blog/:year/:month/:day/:id' => 'posts#show', :as => :full_post
    get '/:year(/:month(/:day))' => 'posts#index', :as => :post_date
    get '/:year/:month/:day/:id' => 'posts#show', :as => :full_post
    end

    get '/blog/search/:query', :to => 'posts#search', :as => :search_posts, :query => /.*/
    get '/search/:query', :to => 'posts#search', :as => :search_posts, :query => /.*/

    resources :posts, :path => 'blog' do
    resources :posts do #, :path => 'blog'
    get :archive, :on => :collection
    end



    end

    namespace :admin do
  6. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    # relevant routes from `rake routes`


    post_date GET /blog/:year(/:month)(/:day)(.:format) {:year=>/\d{4}/, :month=>/\d{1,2}/, :day=>/\d{1,2}/, :controller=>"Blog/posts", :action=>"index"}
    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"}
    search_posts GET /blog/search/:query(.:format) {:query=>/.*/, :controller=>"Blog/posts", :action=>"search"}
    archive_posts GET /blog/archive(.:format) {:action=>"archive", :controller=>"Blog/posts"}
    posts GET /blog(.:format) {:action=>"index", :controller=>"Blog/posts"}
    POST /blog(.:format) {:action=>"create", :controller=>"Blog/posts"}
    new_post GET /blog/new(.:format) {:action=>"new", :controller=>"Blog/posts"}
    edit_post GET /blog/:id/edit(.:format) {:action=>"edit", :controller=>"Blog/posts"}
    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"}
    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"}
  7. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions posts_controller.rb
    Original file line number Diff line number Diff line change
    @@ -31,20 +31,20 @@ def index
    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
    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 archive
    @posts = Post.live.all
    end

    def get_sidebar
    @archive_posts = Post.live.limit(10)
    @@ -55,4 +55,4 @@ def get_tags
    @tags = Post.live.tag_counts.order('count DESC').limit(25)
    end

    end
    end
  8. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 58 additions and 0 deletions.
    58 changes: 58 additions & 0 deletions posts_controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    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
  9. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 0 additions and 48 deletions.
    48 changes: 0 additions & 48 deletions post_integration_test.rb
    Original file line number Diff line number Diff line change
    @@ -1,48 +0,0 @@
    #! /usr/bin/env ruby
    # encoding: UTF-8

    require 'test_helper'

    class Blog::PostIntegrationTest < ActiveSupport::IntegrationCase

    def setup
    Post.destroy_all
    11.times{ |i| Factory.create(:post, :title => "Capy post #{i}", :posted_at => Time.now - i.days) }
    end

    should "get the blog page" do
    visit posts_path
    # first post
    assert has_link?("Capy post 1")
    # last post
    assert has_link?("Capy post 9")
    # archive link
    assert has_link?("View Full Archive")
    # tag link
    assert has_link?("peanut butter")
    # page two
    assert has_link?("2")
    assert has_link?("Next →")
    end

    should "get a blog post" do
    @post = Post.first
    visit full_post_path(@post.year, @post.month, @post.day, @post)
    within('h1') do
    assert has_content?(@post.title)
    end
    end

    should "get the archive" do
    visit archive_posts_path
    assert has_link?("Capy post 1")
    assert has_link?("Shop the store")
    end

    should "get the archive" do
    visit archive_posts_path
    assert has_link?("Capy post 1")
    assert has_link?("Shop the Store")
    end

    end
  10. @citrus citrus revised this gist Jun 3, 2011. 3 changed files with 170 additions and 0 deletions.
    48 changes: 48 additions & 0 deletions post_integration_test.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    #! /usr/bin/env ruby
    # encoding: UTF-8

    require 'test_helper'

    class Blog::PostIntegrationTest < ActiveSupport::IntegrationCase

    def setup
    Post.destroy_all
    11.times{ |i| Factory.create(:post, :title => "Capy post #{i}", :posted_at => Time.now - i.days) }
    end

    should "get the blog page" do
    visit posts_path
    # first post
    assert has_link?("Capy post 1")
    # last post
    assert has_link?("Capy post 9")
    # archive link
    assert has_link?("View Full Archive")
    # tag link
    assert has_link?("peanut butter")
    # page two
    assert has_link?("2")
    assert has_link?("Next →")
    end

    should "get a blog post" do
    @post = Post.first
    visit full_post_path(@post.year, @post.month, @post.day, @post)
    within('h1') do
    assert has_content?(@post.title)
    end
    end

    should "get the archive" do
    visit archive_posts_path
    assert has_link?("Capy post 1")
    assert has_link?("Shop the store")
    end

    should "get the archive" do
    visit archive_posts_path
    assert has_link?("Capy post 1")
    assert has_link?("Shop the Store")
    end

    end
    122 changes: 122 additions & 0 deletions posts_controller_test.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,122 @@
    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
    File renamed without changes.
  11. @citrus citrus revised this gist Jun 3, 2011. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    Rails.application.routes.draw do

    scope(:module => "Blog") do

    constraints(
    :year => /\d{4}/,
    :month => /\d{1,2}/,
    :day => /\d{1,2}/
    ) do
    get '/blog/:year(/:month)(/:day)' => 'posts#index', :as => :post_date
    get '/blog/:year/:month/:day/:id' => 'posts#show', :as => :full_post
    end

    get '/blog/search/:query', :to => 'posts#search', :as => :search_posts, :query => /.*/

    resources :posts, :path => 'blog' do
    get :archive, :on => :collection
    end

    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
  12. @citrus citrus created this gist Jun 3, 2011.
    203 changes: 203 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,203 @@
    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'