mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-22 10:10:12 +01:00
Tweak pie chart data tests
This commit is contained in:
parent
d6ed7d9722
commit
4fe9003855
1 changed files with 12 additions and 22 deletions
|
|
@ -9,8 +9,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_total_actions_data
|
||||
|
||||
expected = "&title=Spread of actions for all contexts,{font-size:16}&\n&pie=70,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=&\n&pie_labels=&\n&links=&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal [], assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_total_with_less_than_10_items
|
||||
|
|
@ -30,9 +29,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_total_actions_data
|
||||
|
||||
expected = "&title=Spread of actions for all contexts,{font-size:16}&\n&pie=70,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=12,4,9,15,23,20,5,1,7&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_total_with_exactly_10_items
|
||||
|
|
@ -53,9 +50,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_total_actions_data
|
||||
|
||||
expected = "&title=Spread of actions for all contexts,{font-size:16}&\n&pie=70,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=10,3,7,12,19,16,4,0,5,18&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine,ten&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9,/contexts/10&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_total_with_more_than_10_items
|
||||
|
|
@ -77,9 +72,9 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_total_actions_data
|
||||
|
||||
expected = "&title=Spread of actions for all contexts,{font-size:16}&\n&pie=70,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=9,3,6,11,16,14,4,0,5,27&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine,(others)&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9,/contexts/-1&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
contexts.pop
|
||||
contexts[-1] = {'id' => -1, 'name' => '(others)', 'total' => 33}
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_running_with_0_items
|
||||
|
|
@ -88,8 +83,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_running_actions_data
|
||||
|
||||
expected = "&title=Spread of running actions for visible contexts,{font-size:16}&\n&pie=60,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=&\n&pie_labels=&\n&links=&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal [], assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_running_with_less_than_10_items
|
||||
|
|
@ -109,9 +103,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_running_actions_data
|
||||
|
||||
expected = "&title=Spread of running actions for visible contexts,{font-size:16}&\n&pie=60,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=12,4,9,15,23,20,5,1,7&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_running_with_exactly_10_items
|
||||
|
|
@ -132,9 +124,7 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_running_actions_data
|
||||
|
||||
expected = "&title=Spread of running actions for visible contexts,{font-size:16}&\n&pie=60,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=10,3,7,12,19,16,4,0,5,18&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine,ten&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9,/contexts/10&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
def test_running_with_more_than_10_items
|
||||
|
|
@ -156,9 +146,9 @@ class ContextActionsDataTest < ActionController::TestCase
|
|||
|
||||
get :context_running_actions_data
|
||||
|
||||
expected = "&title=Spread of running actions for visible contexts,{font-size:16}&\n&pie=60,#505050,{font-size: 12px; color: #404040;}&\n&x_axis_steps=1& &y_ticks=5,10,5& &line=3,#87421F& &y_min=0& &y_max=20&\n&values=9,3,6,11,16,14,4,0,5,27&\n&pie_labels=one,two,three,four,five,six,seven,eight,nine,(others)&\n&links=/contexts/1,/contexts/2,/contexts/3,/contexts/4,/contexts/5,/contexts/6,/contexts/7,/contexts/8,/contexts/9,/contexts/-1&\n&colours=#d01f3c,#356aa0,#C79810,#c61fd0,#1fc6d0,#1fd076,#72d01f,#c6d01f,#d0941f,#40941f&\n&tool_tip=#x_label#: #val#%25&\n&x_label_style=9,,2,1&"
|
||||
|
||||
assert_equal expected, @response.body.chomp
|
||||
contexts.pop
|
||||
contexts[-1] = {'id' => -1, 'name' => '(others)', 'total' => 33}
|
||||
assert_equal contexts, assigns[:actions_per_context]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue