diff --git a/app/controllers/rate_caches_controller.rb b/app/controllers/rate_caches_controller.rb
index 316c991..86ad252 100644
--- a/app/controllers/rate_caches_controller.rb
+++ b/app/controllers/rate_caches_controller.rb
@@ -6,5 +6,17 @@ class RateCachesController < ApplicationController
before_filter :require_admin
def index
+ @last_caching_run = if Setting.plugin_redmine_rate['last_caching_run'].present? && Setting.plugin_redmine_rate['last_caching_run'].to_date
+ format_time(Setting.plugin_redmine_rate['last_caching_run'])
+ else
+ l(:text_no_cache_run)
+ end
+
+ @last_cache_clearing_run = if Setting.plugin_redmine_rate['last_cache_clearing_run'].present? && Setting.plugin_redmine_rate['last_cache_clearing_run'].to_date
+ format_time(Setting.plugin_redmine_rate['last_cache_clearing_run'])
+ else
+ l(:text_no_cache_run)
+ end
+
end
end
diff --git a/app/views/rate_caches/index.html.erb b/app/views/rate_caches/index.html.erb
index 564eb6c..4ed3bc0 100644
--- a/app/views/rate_caches/index.html.erb
+++ b/app/views/rate_caches/index.html.erb
@@ -1 +1,13 @@
<%= l(:text_rate_caches_panel) %>
+
+
+
+ <%= l(:text_last_caching_run) %><%= h(@last_caching_run) %>
+
+
+
+
+
+ <%= l(:text_last_cache_clearing_run) %><%= h(@last_cache_clearing_run) %>
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a529972..97beac7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -9,4 +9,6 @@ en:
rate_label_default: Default Rate
rate_cost: Cost
text_rate_caches_panel: "Rate Caches"
-
+ 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: "
diff --git a/test/integration/admin_panel_test.rb b/test/integration/admin_panel_test.rb
index ea1c94f..2d526df 100644
--- a/test/integration/admin_panel_test.rb
+++ b/test/integration/admin_panel_test.rb
@@ -1,7 +1,17 @@
require 'test_helper'
class AdminPanelTest < ActionController::IntegrationTest
+ include Redmine::I18n
+
def setup
+ @last_caching_run = 4.days.ago.to_s
+ @last_cache_clearing_run = 7.days.ago.to_s
+
+ Setting.plugin_redmine_rate = {
+ 'last_caching_run' => @last_caching_run,
+ 'last_cache_clearing_run' => @last_cache_clearing_run
+ }
+
@user = User.generate!(:admin => true, :password => 'rates', :password_confirmation => 'rates')
login_as(@user.login, 'rates')
@@ -18,8 +28,26 @@ class AdminPanelTest < ActionController::IntegrationTest
end
- should "show the last run timestamp for the last caching run"
- should "show the last run timestamp for the last cache clearing run"
+ should "show the last run timestamp for the last caching run" do
+ click_link "Administration"
+ click_link "Rate Caches"
+
+ assert_select '#caching-run' do
+ assert_select 'p', :text => /#{format_time(@last_caching_run)}/
+ end
+
+ end
+
+ should "show the last run timestamp for the last cache clearing run" do
+ click_link "Administration"
+ click_link "Rate Caches"
+
+ assert_select '#cache-clearing-run' do
+ assert_select 'p', :text => /#{format_time(@last_cache_clearing_run)}/
+ end
+
+ end
+
should "have a button to force a caching run"
should "have a button to force a cache clearing run"
end