test/integration/server_test.rb in interlock-1.3 vs test/integration/server_test.rb in interlock-1.4
- old
+ new
@@ -37,10 +37,27 @@
assert_no_match(/all:untagged is running the controller block/, log)
assert_no_match(/all:untagged wrote/, log)
assert_match(/all:untagged read from memcached/, log)
end
+ def test_controller_respects_log_level
+ remote = <<-CODE
+ RAILS_DEFAULT_LOGGER.level = Logger::INFO;
+ Interlock.config[:log_level] = 'info'
+ CODE
+ remote_eval(remote)
+
+ truncate
+ browse("items")
+ assert_match(/cleared interlock local cache/, log)
+
+ remote_eval("Interlock.config[:log_level] = 'debug'")
+ truncate
+ browse("items")
+ assert_no_match(/cleared interlock local cache/, log)
+ end
+
def test_broad_invalidation
browse("items")
assert_match(/all:untagged is running the controller block/, log)
assert_match(/all:untagged wrote/, log)
@@ -69,26 +86,27 @@
assert_match(/show:1:untagged is running the controller block/, log)
end
def test_caching_with_tag
# This test is a little over-complicated
- sleep(4)
+ remote_eval("Item.update_all('updated_at = NULL')")
+
assert_no_match(/Artichoke/, browse("items/recent?seconds=3"))
assert_match(/recent:all:3 is running the controller block/, log)
truncate
assert_no_match(/Artichoke/, browse("items/recent?seconds=2"))
assert_match(/recent:all:2 is running the controller block/, log)
assert_no_match(/recent:all:3 is running the controller block/, log)
truncate
- remote_eval("Item.find(1).save!")
+ remote_eval("Item.find(1).update_attributes!(:description => 'Changed!')")
assert_match(/Artichoke/, browse("items/recent?seconds=4"))
assert_match(/recent:all:4 is running the controller block/, log)
truncate
assert_no_match(/Artichoke/, browse("items/recent?seconds=3"))
- assert_no_match(/recent:all:3 is running the controller block/, log)
+ assert_no_match(/recent:all:3 is running the controller block/, log)
end
def test_caching_with_perform_false
browse("items/preview/1")
assert_no_match(/preview:1:untagged registered a dependency/, log)
\ No newline at end of file