mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 01:30:12 +01:00
Changes you will need to make: * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install. Other notes on my changes: * Modified our code to take advantage of Rails 2.1's slick time zone support. * Upgraded will_paginate for compatibility * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
43 lines
1.1 KiB
Ruby
43 lines
1.1 KiB
Ruby
require 'abstract_unit'
|
|
require "fixtures/person"
|
|
require "fixtures/street_address"
|
|
|
|
class BaseEqualityTest < Test::Unit::TestCase
|
|
def setup
|
|
@new = Person.new
|
|
@one = Person.new(:id => 1)
|
|
@two = Person.new(:id => 2)
|
|
@street = StreetAddress.new(:id => 2)
|
|
end
|
|
|
|
def test_should_equal_self
|
|
assert @new == @new, '@new == @new'
|
|
assert @one == @one, '@one == @one'
|
|
end
|
|
|
|
def test_shouldnt_equal_new_resource
|
|
assert @new != @one, '@new != @one'
|
|
assert @one != @new, '@one != @new'
|
|
end
|
|
|
|
def test_shouldnt_equal_different_class
|
|
assert @two != @street, 'person != street_address with same id'
|
|
assert @street != @two, 'street_address != person with same id'
|
|
end
|
|
|
|
def test_eql_should_alias_equals_operator
|
|
assert_equal @new == @new, @new.eql?(@new)
|
|
assert_equal @new == @one, @new.eql?(@one)
|
|
|
|
assert_equal @one == @one, @one.eql?(@one)
|
|
assert_equal @one == @new, @one.eql?(@new)
|
|
|
|
assert_equal @one == @street, @one.eql?(@street)
|
|
end
|
|
|
|
def test_hash_should_be_id_hash
|
|
[@new, @one, @two, @street].each do |resource|
|
|
assert_equal resource.id.hash, resource.hash
|
|
end
|
|
end
|
|
end
|