require 'test_helper' class PostsControllerTest < ActionController::TestCase test "should update post" do post = Post.create!(:title => "Hello, World", :body => "This is a test.", :author => "Matt Haley") assert !post.new_record? assert_difference("Audit.count") do put :update, :id => post.to_param, :post => { :title => "First post!" } assert_redirected_to post_path(assigns(:post)) audit = assigns(:post).audits.first assert_equal ["Hello, World", "First post!"], audit.change_set["title"] end end end