[#4604] Add an admin panel for the rate caches
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AdminPanelTest < ActionController::IntegrationTest
|
||||
def setup
|
||||
@user = User.generate!(:admin => true, :password => 'rates', :password_confirmation => 'rates')
|
||||
|
||||
login_as(@user.login, 'rates')
|
||||
end
|
||||
|
||||
context "Rate Caches admin panel" do
|
||||
should "be listed in the main Admin section" do
|
||||
click_link "Administration"
|
||||
assert_response :success
|
||||
|
||||
assert_select "#admin-menu" do
|
||||
assert_select "a.rate-caches"
|
||||
end
|
||||
|
||||
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 "have a button to force a caching run"
|
||||
should "have a button to force a cache clearing run"
|
||||
end
|
||||
end
|
||||
@@ -3,3 +3,41 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper
|
||||
|
||||
# Ensure that we are using the temporary fixture path
|
||||
Engines::Testing.set_fixture_path
|
||||
|
||||
require "webrat"
|
||||
|
||||
Webrat.configure do |config|
|
||||
config.mode = :rails
|
||||
end
|
||||
|
||||
module IntegrationTestHelper
|
||||
def login_as(user="existing", password="existing")
|
||||
visit "/login"
|
||||
fill_in 'Login', :with => user
|
||||
fill_in 'Password', :with => password
|
||||
click_button 'login'
|
||||
assert_response :success
|
||||
assert User.current.logged?
|
||||
end
|
||||
|
||||
def logout
|
||||
visit '/logout'
|
||||
assert_response :success
|
||||
assert !User.current.logged?
|
||||
end
|
||||
|
||||
def assert_forbidden
|
||||
assert_response :forbidden
|
||||
assert_template 'common/403'
|
||||
end
|
||||
|
||||
def assert_requires_login
|
||||
assert_response :success
|
||||
assert_template 'account/login'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ActionController::IntegrationTest
|
||||
include IntegrationTestHelper
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user