diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-12 18:19:28 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-12 19:41:17 +0100 |
commit | 9a51053c1d0fe4db66f82c93454b8fd8e6d7e192 (patch) | |
tree | b7624d9e960be337c53222e8ac6eb5f03244c6b2 /activesupport/test | |
parent | 2fdc3ab0f10c6614f37621847ff92e8e17283df5 (diff) | |
download | rails-9a51053c1d0fe4db66f82c93454b8fd8e6d7e192.tar.gz rails-9a51053c1d0fe4db66f82c93454b8fd8e6d7e192.tar.bz2 rails-9a51053c1d0fe4db66f82c93454b8fd8e6d7e192.zip |
Update checker returns a boolean if callback was executed or not.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/file_update_checker_test.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/activesupport/test/file_update_checker_test.rb b/activesupport/test/file_update_checker_test.rb index 425931f49a..71290c179c 100644 --- a/activesupport/test/file_update_checker_test.rb +++ b/activesupport/test/file_update_checker_test.rb @@ -42,19 +42,18 @@ module FileUpdateCheckerSuite def test_should_not_invoke_the_block_if_no_file_has_changed i = 0 - checker = ActiveSupport::FileUpdateChecker.new(args){ i += 1 } - 5.times { checker.execute_if_updated } - assert_equal 1, i + checker = ActiveSupport::FileUpdateChecker.new(args, true){ i += 1 } + 5.times { assert !checker.execute_if_updated } + assert_equal 0, i end def test_should_invoke_the_block_if_a_file_has_changed i = 0 - checker = ActiveSupport::FileUpdateChecker.new(args){ i += 1 } - checker.execute_if_updated + checker = ActiveSupport::FileUpdateChecker.new(args, true){ i += 1 } sleep(1) FileUtils.touch(FILES) - checker.execute_if_updated - assert_equal 2, i + assert checker.execute_if_updated + assert_equal 1, i end end |