@@ -55,4 +55,32 class SettingTest < ActiveSupport::TestCase | |||
|
55 | 55 | Setting.clear_cache |
|
56 | 56 | assert_equal "New title", Setting.app_title |
|
57 | 57 | end |
|
58 | ||
|
59 | def test_per_page_options_array_should_be_an_empty_array_when_setting_is_blank | |
|
60 | with_settings :per_page_options => nil do | |
|
61 | assert_equal [], Setting.per_page_options_array | |
|
62 | end | |
|
63 | ||
|
64 | with_settings :per_page_options => '' do | |
|
65 | assert_equal [], Setting.per_page_options_array | |
|
66 | end | |
|
67 | end | |
|
68 | ||
|
69 | def test_per_page_options_array_should_be_an_array_of_integers | |
|
70 | with_settings :per_page_options => '10, 25, 50' do | |
|
71 | assert_equal [10, 25, 50], Setting.per_page_options_array | |
|
72 | end | |
|
73 | end | |
|
74 | ||
|
75 | def test_per_page_options_array_should_omit_non_numerial_values | |
|
76 | with_settings :per_page_options => 'a, 25, 50' do | |
|
77 | assert_equal [25, 50], Setting.per_page_options_array | |
|
78 | end | |
|
79 | end | |
|
80 | ||
|
81 | def test_per_page_options_array_should_be_sorted | |
|
82 | with_settings :per_page_options => '25, 10, 50' do | |
|
83 | assert_equal [10, 25, 50], Setting.per_page_options_array | |
|
84 | end | |
|
85 | end | |
|
58 | 86 | end |
General Comments 0
You need to be logged in to leave comments.
Login now