Sha256: 992a64525ed3ff85ff560d735bfa176e26b21b2191f93c5929ffa156dd2f4961

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class TaggingTest < Test::Unit::TestCase
  context 'Tagging a version' do
    setup do
      @user = User.create(:name => 'Steve Richert')
      @user.update_attribute(:last_name, 'Jobs')
    end

    should "update the version record's tag column" do
      tag_name = 'TAG'
      assert_not_equal tag_name, @user.versions.last.tag
      @user.tag_version(tag_name)
      assert_equal tag_name, @user.versions.last.tag
    end

    should 'create a version record for an initial version' do
      @user.revert_to(1)
      assert_nil @user.versions.at(1)
      @user.tag_version('TAG')
      assert_not_nil @user.versions.at(1)
    end
  end

  context 'A tagged version' do
    setup do
      user = User.create(:name => 'Steve Richert')
      user.update_attribute(:last_name, 'Jobs')
      user.tag_version('TAG')
      @version = user.versions.last
    end

    should 'return true for the "tagged?" method' do
      assert @version.respond_to?(:tagged?)
      assert_equal true, @version.tagged?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vestal_versions-1.0.1 test/tagging_test.rb
vestal_versions-1.0.0 test/tagging_test.rb