小编Tho*_*mas的帖子

Rails 操作缓存 RSpec 测试失败

我有一个规范,用于在禁用缓存和启用缓存时测试操作缓存。看起来测试执行的顺序会影响它们是否通过。

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。我很困惑为什么无缓存测试会影响缓存测试。有谁知道出了什么问题吗?

rspec ruby-on-rails action-caching

5
推荐指数
1
解决办法
2047
查看次数

使用JQuery css方法的自定义CSS游标

有没有办法可以使用JQuery的.css()方法来提供以下光标样式?:

cursor: url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), default !important;
Run Code Online (Sandbox Code Playgroud)

css jquery

4
推荐指数
1
解决办法
5304
查看次数

标签 统计

action-caching ×1

css ×1

jquery ×1

rspec ×1

ruby-on-rails ×1