Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
macario
committed
Oct 1, 2012
1 parent
de6d48c
commit f921eff
Showing
5 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,7 @@ db | |
|
||
/doc | ||
/.idea | ||
*.swo | ||
*.swp | ||
|
||
test/connections/databases.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Test cases devised by Santiago that broke the Composite Primary Keys | ||
# code at one point in time. But no more!!! | ||
require File.expand_path('../abstract_unit', __FILE__) | ||
|
||
class TestTouch < ActiveSupport::TestCase | ||
fixtures :products, :tariffs | ||
|
||
def test_touching_a_record_updates_its_timestamp | ||
tariff = tariffs(:flat) | ||
previous_amount = tariff.amount | ||
previously_updated_at = tariff.updated_at | ||
|
||
tariff.amount = previous_amount + 1 | ||
tariff.touch | ||
|
||
assert_not_equal previously_updated_at, tariff.updated_at | ||
assert_equal previous_amount + 1, tariff.amount | ||
assert tariff.amount_changed?, 'tarif amount should have changed' | ||
assert tariff.changed?, 'tarif should be marked as changed' | ||
tariff.reload | ||
assert_not_equal previously_updated_at, tariff.updated_at | ||
end | ||
end |