Sha256: 251ebb36d02acdeae4d8141e4f81c46c3c10d968cabaa829ab16871f325c4a28

Contents?: true

Size: 1.55 KB

Versions: 27

Compression:

Stored size: 1.55 KB

Contents

require 'test_helper'

module Notee
  class PostsControllerTest < ActionController::TestCase
    setup do
      @post = notee_posts(:one)
      @routes = Engine.routes
    end

    test "should get index" do
      get :index
      assert_response :success
      assert_not_nil assigns(:posts)
    end

    test "should get new" do
      get :new
      assert_response :success
    end

    test "should create post" do
      assert_difference('Post.count') do
        post :create, post: { category_id: @post.category_id, content: @post.content, published_at: @post.published_at, seo_description: @post.seo_description, seo_keyword: @post.seo_keyword, slug: @post.slug, status: @post.status, thumbnail_id: @post.thumbnail_id, title: @post.title }
      end

      assert_redirected_to post_path(assigns(:post))
    end

    test "should show post" do
      get :show, id: @post
      assert_response :success
    end

    test "should get edit" do
      get :notee, id: @post
      assert_response :success
    end

    test "should update post" do
      patch :update, id: @post, post: { category_id: @post.category_id, content: @post.content, published_at: @post.published_at, seo_description: @post.seo_description, seo_keyword: @post.seo_keyword, slug: @post.slug, status: @post.status, thumbnail_id: @post.thumbnail_id, title: @post.title }
      assert_redirected_to post_path(assigns(:post))
    end

    test "should destroy post" do
      assert_difference('Post.count', -1) do
        delete :destroy, id: @post
      end

      assert_redirected_to posts_path
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
notee-0.2.7 test/controllers/notee/posts_controller_test.rb
notee-0.2.6 test/controllers/notee/posts_controller_test.rb
notee-0.2.5 test/controllers/notee/posts_controller_test.rb
notee-0.2.4 test/controllers/notee/posts_controller_test.rb
notee-0.2.2 test/controllers/notee/posts_controller_test.rb
notee-0.2.1 test/controllers/notee/posts_controller_test.rb
notee-0.2.0 test/controllers/notee/posts_controller_test.rb