Sha256: b144937d3a1dbe12abfc0bdb9670878484d5e545acb6f8df251c98d9d3e60c84
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper')) class VersionTest < Test::Unit::TestCase context 'Versions' do setup do @user = User.create(:name => 'Stephen Richert') @user.update_attribute(:name, 'Steve Jobs') @user.update_attribute(:last_name, 'Richert') @first_version, @last_version = @user.versions.first, @user.versions.last end should 'be comparable to another version based on version number' do assert @first_version == @first_version assert @last_version == @last_version assert @first_version != @last_version assert @last_version != @first_version assert @first_version < @last_version assert @last_version > @first_version assert @first_version <= @last_version assert @last_version >= @first_version end should "not equal a separate model's version with the same number" do user = User.create(:name => 'Stephen Richert') user.update_attribute(:name, 'Steve Jobs') user.update_attribute(:last_name, 'Richert') first_version, last_version = user.versions.first, user.versions.last assert_not_equal @first_version, first_version assert_not_equal @last_version, last_version end should 'default to ordering by number when finding through association' do numbers = @user.versions.map(&:number) assert_equal numbers.sort, numbers end should 'return true for the "initial?" method when the version number is 1' do version = @user.versions.build(:number => 1) assert_equal 1, version.number assert_equal true, version.initial? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bitfluent-vestal_versions-1.1.0 | test/version_test.rb |