Sha256: d21f5b0d117603a5ef7d97912e1f88d2c416278648855e6f9279627a8c723a85
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
require 'test_helper' class LinkTest < ActiveSupport::TestCase def setup @link = Factory(:link) @another_link = Factory(:link) end def test_create assert Factory.build(:link).valid? assert !Factory.build(:link, :name => "").valid? end test "draft_version is stored on pages" do assert_equal 1, @link.version assert_equal 1, @link.latest_version end test "#update increments the latest_version" do @link.name = "New" @link.save! @link.reload assert_equal 1, @link.version assert_equal 2, @link.latest_version assert_equal 1, @another_link.reload.latest_version, "Should only update its own version, not other tables" end test "live?" do assert @link.live? end test "updating makes it not live" do @link.update_attributes(:name => "New") @link.reload refute @link.live? @link.publish! @link.reload assert @link.live? end test "live? as_of_version" do @link.update_attributes(:name => "New") @link.publish! v1 = @link.as_of_version(1) assert v1.live? end end
Version data entries
6 entries across 6 versions & 1 rubygems