Sha256: 90557d31739f9b9553f5fea0da08770851432df9337eca81381b58653b1563a4

Contents?: true

Size: 552 Bytes

Versions: 3

Compression:

Stored size: 552 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
track_changes-0.5.0 test/functional/posts_controller_test.rb
track_changes-0.4.1 test/functional/posts_controller_test.rb
track_changes-0.4.0 test/functional/posts_controller_test.rb