Sha256: acf3a1df29adb47ccd5888300781a84e19428d821f9a2bc64bca2db7f3e3a4d8

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'

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

3 entries across 3 versions & 2 rubygems

Version Path
focused_controller-1.0.0 test/app/test/functional/posts_controller_test.rb
controll-0.2.0 spec/app/test/functional/posts_controller_test.rb
focused_controller-0.2.0 test/app/test/functional/posts_controller_test.rb