Fix #1030. add basic test for new chart.

This commit is contained in:
Reinier Balt 2012-01-21 20:29:59 +01:00
parent 1bce9a670d
commit b7ee2f79f5

View file

@ -32,6 +32,7 @@ class StatsControllerTest < ActionController::TestCase
actions_completion_time_data actions_completion_time_data
actions_visible_running_time_data actions_visible_running_time_data
actions_running_time_data actions_running_time_data
actions_open_per_week_data
actions_day_of_week_all_data actions_day_of_week_all_data
actions_day_of_week_30days_data actions_day_of_week_30days_data
actions_time_of_day_all_data actions_time_of_day_all_data
@ -220,6 +221,23 @@ class StatsControllerTest < ActionController::TestCase
assert_equal 100.0, assigns['cumm_percent_done'][17], "cummulative percentage should add up to 100%" assert_equal 100.0, assigns['cumm_percent_done'][17], "cummulative percentage should add up to 100%"
end end
def test_actions_open_per_week_data
login_as(:admin_user)
@current_user = User.find(users(:admin_user).id)
@current_user.todos.delete_all
given_todos_for_stats
# When I get the chart data
get :actions_open_per_week_data
assert_response :success
# do not test stuff already implicitly tested in other tests
assert_equal 17, assigns['max_weeks'], "there are actions in the first 17 weeks of this year"
assert_equal 4, assigns['max_actions'], "4 actions running together"
assert_equal 17, assigns['actions_open_per_week_array'].size, "there should be 17 weeks ( < cut_off) of data"
end
def test_actions_visible_running_time_data def test_actions_visible_running_time_data
login_as(:admin_user) login_as(:admin_user)
@current_user = User.find(users(:admin_user).id) @current_user = User.find(users(:admin_user).id)