Sha256: 7c4c4cbd091b89558534e7fc41bdb3f1764d00031b31f3d7369906698452dd2d
Contents?: true
Size: 1.57 KB
Versions: 8
Compression:
Stored size: 1.57 KB
Contents
require 'test_helper' require_dependency 'posts_controller' module PostsController class TestCase < ActiveSupport::TestCase include FocusedController::TestHelper setup do @post = Post.create(:title => 'Hello', :body => 'Omg') end end class IndexTest < TestCase test "should get index" do controller.call assert_response :success assert_not_nil controller.posts end end class NewTest < TestCase test "should get new" do controller.call assert_response :success end end class CreateTest < TestCase test "should create post" do controller.params = { :post => @post.attributes } assert_difference('Post.count') do controller.call end assert_redirected_to post_path(controller.post) end end class ShowTest < TestCase test "should show post" do controller.params = { :id => @post.id } controller.call assert_response :success end end class EditTest < TestCase test "should get edit" do controller.params = { :id => @post.id } controller.call assert_response :success end end class UpdateTest < TestCase test "should update post" do controller.params = { :id => @post.id } controller.call assert_redirected_to post_path(controller.post) end end class DestroyTest < TestCase test "should destroy post" do controller.params = { :id => @post.id } assert_difference('Post.count', -1) do controller.call end assert_redirected_to posts_path end end end
Version data entries
8 entries across 8 versions & 1 rubygems