Sha256: e918ffeafe08c64e83ae30b1f2d1a6bd601b118dcddd9753def3f1aff6322042

Contents?: true

Size: 967 Bytes

Versions: 6

Compression:

Stored size: 967 Bytes

Contents

require 'test_helper'

class PaperTrailTest < ActiveSupport::TestCase
  test 'Sanity test' do
    assert_kind_of Module, PaperTrail::Version
  end

  test 'Version Number' do
    assert PaperTrail.const_defined?(:VERSION)
  end
  
  test 'enabled is thread-safe' do
    Thread.new do
      PaperTrail.enabled = false
    end.join
    assert PaperTrail.enabled?
  end

  test 'create with plain model class' do
    widget = Widget.create
    assert_equal 1, widget.versions.length
  end

  test 'update with plain model class' do
    widget = Widget.create
    assert_equal 1, widget.versions.length
    widget.update_attributes(:name => 'Bugle')
    assert_equal 2, widget.versions.length
  end

  test 'destroy with plain model class' do
    widget = Widget.create
    assert_equal 1, widget.versions.length
    widget.destroy
    versions_for_widget = PaperTrail::Version.with_item_keys('Widget', widget.id)
    assert_equal 2, versions_for_widget.length
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paper_trail-4.2.0 test/paper_trail_test.rb
paper_trail-4.1.0 test/paper_trail_test.rb
paper_trail-4.0.2 test/paper_trail_test.rb
paper_trail-4.0.1 test/paper_trail_test.rb
paper_trail-4.0.0 test/paper_trail_test.rb
paper_trail-4.0.0.rc2 test/paper_trail_test.rb