mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 01:30:12 +01:00
Removed superfluous 'tracks' directory at the root of the repository.
Testing commits to github.
This commit is contained in:
parent
6a42901514
commit
4cbf5a34d3
2269 changed files with 0 additions and 0 deletions
94
test/functional/stats_controller_test.rb
Executable file
94
test/functional/stats_controller_test.rb
Executable file
|
|
@ -0,0 +1,94 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'stats_controller'
|
||||
|
||||
# Re-raise errors caught by the controller.
|
||||
class StatsController; def rescue_action(e) raise e end; end
|
||||
|
||||
class StatsControllerTest < Test::Unit::TestCase
|
||||
fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings
|
||||
|
||||
def setup
|
||||
@controller = StatsController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
# Replace this with your real tests.
|
||||
def test_truth
|
||||
assert true
|
||||
end
|
||||
|
||||
def test_get_index_when_not_logged_in
|
||||
get :index
|
||||
assert_redirected_to :controller => 'login', :action => 'login'
|
||||
end
|
||||
|
||||
def test_get_index
|
||||
login_as(:admin_user)
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_get_charts
|
||||
login_as(:admin_user)
|
||||
%w{ actions_done_last30days_data
|
||||
actions_done_last12months_data
|
||||
actions_completion_time_data
|
||||
actions_visible_running_time_data
|
||||
actions_running_time_data
|
||||
actions_day_of_week_all_data
|
||||
actions_day_of_week_30days_data
|
||||
actions_time_of_day_all_data
|
||||
actions_time_of_day_30days_data
|
||||
context_total_actions_data
|
||||
context_running_actions_data
|
||||
}.each do |action|
|
||||
get action
|
||||
assert_response :success
|
||||
assert_template "stats/"+action
|
||||
end
|
||||
end
|
||||
|
||||
def test_totals
|
||||
login_as(:admin_user)
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_equal 3, assigns['projects'].count
|
||||
assert_equal 3, assigns['projects'].count(:conditions => "state = 'active'")
|
||||
assert_equal 10, assigns['contexts'].count
|
||||
assert_equal 15, assigns['actions'].count
|
||||
assert_equal 4, assigns['tags'].count
|
||||
assert_equal 2, assigns['unique_tags'].size
|
||||
assert_equal 2.week.ago.utc.beginning_of_day, assigns['first_action'].created_at
|
||||
end
|
||||
|
||||
def test_downdrill
|
||||
login_as(:admin_user)
|
||||
|
||||
# drill down without parameters
|
||||
get :show_selected_actions_from_chart
|
||||
assert_response :not_found
|
||||
assert_template nil
|
||||
|
||||
# get week 0-1 for actions visible running
|
||||
get :show_selected_actions_from_chart, :id => 'avrt', :index => 0
|
||||
assert_response :success
|
||||
assert_template "stats/show_selection_from_chart"
|
||||
|
||||
# get week 0 and further for actions visible running
|
||||
get :show_selected_actions_from_chart, :id => 'avrt_end', :index => 0
|
||||
assert_response :success
|
||||
assert_template "stats/show_selection_from_chart"
|
||||
|
||||
# get week 0-1 for actions running
|
||||
get :show_selected_actions_from_chart, :id => 'art', :index => 0
|
||||
assert_response :success
|
||||
assert_template "stats/show_selection_from_chart"
|
||||
|
||||
# get week 0 and further for actions running
|
||||
get :show_selected_actions_from_chart, :id => 'art_end', :index => 0
|
||||
assert_response :success
|
||||
assert_template "stats/show_selection_from_chart"
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue