From e4f1a623f1a007f58ba9e6c5af33bc9a7a4c2e5e Mon Sep 17 00:00:00 2001
From: Eric Davis
+ <%= button_to(l(:text_load_missing_caches), {:controller => 'rate_caches', :action => 'update', :cache => 'missing'}, :method => :put) %> + <%= button_to(l(:text_clear_and_load_all_caches), {:controller => 'rate_caches', :action => 'update', :cache => 'reload'}, :method => :put) %> +
diff --git a/config/locales/en.yml b/config/locales/en.yml index 97beac7..7753cf9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,3 +12,7 @@ en: text_no_cache_run: "no cache run found" text_last_caching_run: "Last caching run at: " text_last_cache_clearing_run: "Last cache clearing run at: " + text_load_missing_caches: "Load Missing Caches" + text_clear_and_load_all_caches: "Clear and Load All Caches" + text_caches_loaded_successfully: "Caches loaded successfully" + diff --git a/config/routes.rb b/config/routes.rb index dabf47c..93bd22b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ ActionController::Routing::Routes.draw do |map| map.resources :rates + map.connect 'rate_caches', :conditions => {:method => :put}, :controller => 'rate_caches', :action => 'update' end diff --git a/test/integration/admin_panel_test.rb b/test/integration/admin_panel_test.rb index 2d526df..a07632b 100644 --- a/test/integration/admin_panel_test.rb +++ b/test/integration/admin_panel_test.rb @@ -48,7 +48,34 @@ class AdminPanelTest < ActionController::IntegrationTest end - should "have a button to force a caching run" - should "have a button to force a cache clearing run" + should "have a button to force a caching run" do + click_link "Administration" + click_link "Rate Caches" + click_button "Load Missing Caches" + + assert_response :success + + appx_clear_time = Date.today.strftime("%m/%d/%Y") + + assert_select '#caching-run' do + assert_select 'p', :text => /#{appx_clear_time}/ + end + + end + + should "have a button to force a cache clearing run" do + click_link "Administration" + click_link "Rate Caches" + click_button "Clear and Load All Caches" + + assert_response :success + + appx_clear_time = Date.today.strftime("%m/%d/%Y") + + assert_select '#cache-clearing-run' do + assert_select 'p', :text => /#{appx_clear_time}/ + end + + end end end