Sha256: f4672c0db0fd95c9473c2f3f21d7f9806c54832116e3b616d58836b8cec6a10a

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'
require_dependency 'posts_controller'

module PostsController
  class TestCase < ActionController::TestCase
    include FocusedController::FunctionalTestHelper

    setup do
      @post = Post.create(:title => 'Hello', :body => 'Omg')
    end
  end

  class IndexTest < TestCase
    test "should get index" do
      get
      assert_response :success
      assert_not_nil @controller.posts
    end
  end

  class NewTest < TestCase
    test "should get new" do
      get
      assert_response :success
    end
  end

  class CreateTest < TestCase
    test "should create post" do
      assert_difference('Post.count') do
        post :post => @post.attributes
      end

      assert_redirected_to post_path(@controller.post)
    end
  end

  class ShowTest < TestCase
    test "should show post" do
      get :id => @post.id
      assert_response :success
    end
  end

  class EditTest < TestCase
    test "should get edit" do
      get :id => @post.id
      assert_response :success
    end
  end

  class UpdateTest < TestCase
    test "should update post" do
      put :id => @post.id, :post => @post.attributes
      assert_redirected_to post_path(@controller.post)
    end
  end

  class DestroyTest < TestCase
    test "should destroy post" do
      assert_difference('Post.count', -1) do
        delete :id => @post.id
      end

      assert_redirected_to posts_path
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
focused_controller-2.0.3 test/app/test/functional/posts_controller_test.rb
focused_controller-2.0.2 test/app/test/functional/posts_controller_test.rb
focused_controller-2.0.1 test/app/test/functional/posts_controller_test.rb
focused_controller-2.0.0 test/app/test/functional/posts_controller_test.rb
focused_controller-1.2.1 test/app/test/functional/posts_controller_test.rb
focused_controller-1.2.0 test/app/test/functional/posts_controller_test.rb
focused_controller-1.1.1 test/app/test/functional/posts_controller_test.rb
focused_controller-1.1.0 test/app/test/functional/posts_controller_test.rb