Sha256: b69a5872b73433225f8b898797e320ae7becd370a0fcae0a462fcdc8a010644f

Contents?: true

Size: 1.83 KB

Versions: 9

Compression:

Stored size: 1.83 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class Muck::PostsControllerTest < ActionController::TestCase

  tests Muck::PostsController

  context "posts controller" do
    setup do
      @user = Factory(:user)
      @blog = @user.blog
      @post = Factory(:content, :contentable => @blog)
      @post_too = Factory(:content, :contentable => @blog)
    end

    context "GET show" do
      setup do
        get :show, :id => @post.to_param, :blog_id => @blog.id
      end
      should_not_set_the_flash
      should_respond_with :success
      should_render_template :show
    end
    
    context "GET nested show with numeric post id" do
      setup do
        get :show, :id => @post.id, :user_id => @user.to_param
      end
      should_not_set_the_flash
      should_respond_with 301 # will do a permanent redirect since we called show with a numeric id
    end
    
    context "GET nested show" do
      setup do
        get :show, :id => @post.to_param, :user_id => @user.to_param
      end
      should_not_set_the_flash
      should_respond_with :success
      should_render_template :show
    end
    
    context "GET show using parent and blog" do
      setup do
        get :show, make_parent_params(@user).merge(:id => @post.to_param)
      end
      should_not_set_the_flash
      should_respond_with :success
      should_render_template :show
    end
    
    context "GET index using user as parent object" do
      setup do
        get :index, make_parent_params(@user)
      end
      should_not_set_the_flash
      should_respond_with :success
      should_render_template :index
    end
    
    
    context "GET index using user_id" do
      setup do
        get :index, :user_id => @user.to_param
      end
      should_not_set_the_flash
      should_respond_with :success
      should_render_template :index
    end
    
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
muck-blogs-0.1.8 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.7 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.6 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.5 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.4 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.1 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.2 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.3 test/rails_root/test/functional/posts_controller_test.rb
muck-blogs-0.1.0 test/rails_root/test/functional/posts_controller_test.rb