Sha256: fe80007cb6985561ebe1258485e564c7f9cc8e8c5089f058e0a4016802ff524d

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

require File.expand_path('../abstract_unit', __FILE__)

class TestEnum < ActiveSupport::TestCase
  fixtures :comments

  def test_enum_was
    comment = Comment.first
    assert_nil comment.shown
    assert_equal({}, comment.changed_attributes)
    comment.shown = :true
    assert_equal({ "shown" => nil }, comment.changed_attributes)
    assert_equal 'true', comment.shown
    assert_nil comment.shown_was

    comment.save

    comment.shown = :false
    assert_equal 'false', comment.shown
    assert_equal 'true', comment.shown_was
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-11.0.0.rc2 test/test_enum.rb