Merge pull request #3697 from riking/patch-6

FEATURE: Allow plugins to add admin dashboard warnings
This commit is contained in:
Robin Ward
2015-09-08 16:49:58 -04:00
2 changed files with 63 additions and 21 deletions

View File

@@ -2,6 +2,36 @@ require 'spec_helper'
describe AdminDashboardData do
describe "adding new checks" do
after do
AdminDashboardData.reset_problem_checks
end
it 'calls the passed block' do
called = false
AdminDashboardData.add_problem_check do
called = true
end
AdminDashboardData.fetch_problems
expect(called).to eq(true)
end
it 'calls the passed method' do
$test_AdminDashboardData_global = false
class AdminDashboardData
def my_test_method
$test_AdminDashboardData_global = true
end
end
AdminDashboardData.add_problem_check :my_test_method
AdminDashboardData.fetch_problems
expect($test_AdminDashboardData_global).to eq(true)
$test_AdminDashboardData_global = nil
end
end
describe "rails_env_check" do
subject { described_class.new.rails_env_check }