我有一个规范,用于在禁用缓存和启用缓存时测试操作缓存。看起来测试执行的顺序会影响它们是否通过。
it "should not cache the index page when we're not caching" do
ActionController::Base.perform_caching = false
HomeController.caches_action :index
Rails.cache.clear
ActionController::Base.cache_store.exist?(:index_cache_path).should be_false
get :index
ActionController::Base.cache_store.exist?(:index_cache_path).should be_false
end
it "should cache the index page when we're caching" do
ActionController::Base.perform_caching = true
HomeController.caches_action :index
Rails.cache.clear
ActionController::Base.cache_store.exist?(:index_cache_path).should be_false
get :index
ActionController::Base.cache_store.exist?(:index_cache_path).should be_true
end
Run Code Online (Sandbox Code Playgroud)
当按上述顺序运行测试时,最后一个测试会失败,因为最后一个期望中不存在cache_store。我很困惑为什么无缓存测试会影响缓存测试。有谁知道出了什么问题吗?
有没有办法可以使用JQuery的.css()方法来提供以下光标样式?:
cursor: url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), default !important;
Run Code Online (Sandbox Code Playgroud)