@@ -106,60 +106,34 class WelcomeControllerTest < ActionController::TestCase | |||
|
106 | 106 | end |
|
107 | 107 | end |
|
108 | 108 | |
|
109 |
|
|
|
110 | context "without params" do | |
|
111 | should "return 0, 25" do | |
|
109 | def test_api_offset_and_limit_without_params | |
|
112 | 110 |
|
|
113 | 111 |
|
|
114 | end | |
|
115 | 112 | |
|
116 | context "with limit" do | |
|
117 | should "return 0, limit" do | |
|
113 | def test_api_offset_and_limit_with_limit | |
|
118 | 114 |
|
|
119 | end | |
|
120 | ||
|
121 | should "not exceed 100" do | |
|
122 | 115 |
|
|
123 | end | |
|
124 | ||
|
125 | should "not be negative" do | |
|
126 | 116 |
|
|
127 | 117 |
|
|
128 | end | |
|
129 | 118 | |
|
130 | context "with offset" do | |
|
131 | should "return offset, 25" do | |
|
119 | def test_api_offset_and_limit_with_offset | |
|
132 | 120 |
|
|
133 | end | |
|
134 | ||
|
135 | should "not be negative" do | |
|
136 | 121 |
|
|
137 | 122 |
|
|
138 | 123 | |
|
139 | context "and limit" do | |
|
140 | should "return offset, limit" do | |
|
124 | def test_api_offset_and_limit_with_offset_and_limit | |
|
141 | 125 |
|
|
142 | 126 |
|
|
143 | end | |
|
144 | end | |
|
145 | 127 | |
|
146 | context "with page" do | |
|
147 | should "return offset, 25" do | |
|
128 | def test_api_offset_and_limit_with_page | |
|
148 | 129 |
|
|
149 | 130 |
|
|
150 | end | |
|
151 | ||
|
152 | should "not be negative" do | |
|
153 | 131 |
|
|
154 | 132 |
|
|
155 | 133 |
|
|
156 | 134 | |
|
157 | context "and limit" do | |
|
158 | should "return offset, limit" do | |
|
135 | def test_api_offset_and_limit_with_page_and_limit | |
|
159 | 136 |
|
|
160 | 137 |
|
|
161 | 138 |
|
|
162 | 139 | end |
|
163 | end | |
|
164 | end | |
|
165 | end |
@@ -35,9 +35,7 class ApplicationHelperTest < ActionView::TestCase | |||
|
35 | 35 | set_tmp_attachments_directory |
|
36 | 36 | end |
|
37 | 37 | |
|
38 | context "#link_to_if_authorized" do | |
|
39 | context "for authorized user" do | |
|
40 | should "allow using the :controller and :action for the target link" do | |
|
38 | test "#link_to_if_authorized for authorized user should allow using the :controller and :action for the target link" do | |
|
41 | 39 |
|
|
42 | 40 | |
|
43 | 41 |
|
@@ -45,10 +43,8 class ApplicationHelperTest < ActionView::TestCase | |||
|
45 | 43 |
|
|
46 | 44 |
|
|
47 | 45 |
|
|
48 | end | |
|
49 | 46 | |
|
50 | context "for unauthorized user" do | |
|
51 | should "display nothing if user isn't authorized" do | |
|
47 | test "#link_to_if_authorized for unauthorized user should display nothing if user isn't authorized" do | |
|
52 | 48 |
|
|
53 | 49 |
|
|
54 | 50 |
|
@@ -58,8 +54,6 class ApplicationHelperTest < ActionView::TestCase | |||
|
58 | 54 |
|
|
59 | 55 |
|
|
60 | 56 |
|
|
61 | end | |
|
62 | end | |
|
63 | 57 | |
|
64 | 58 | def test_auto_links |
|
65 | 59 | to_test = { |
@@ -91,55 +91,39 class RoleTest < ActiveSupport::TestCase | |||
|
91 | 91 | assert_equal Role.all.reject(&:builtin?).sort, Role.find_all_givable |
|
92 | 92 | end |
|
93 | 93 | |
|
94 | context "#anonymous" do | |
|
95 | should "return the anonymous role" do | |
|
94 | def test_anonymous_should_return_the_anonymous_role | |
|
95 | assert_no_difference('Role.count') do | |
|
96 | 96 | role = Role.anonymous |
|
97 | 97 | assert role.builtin? |
|
98 | 98 | assert_equal Role::BUILTIN_ANONYMOUS, role.builtin |
|
99 | 99 | end |
|
100 | ||
|
101 | context "with a missing anonymous role" do | |
|
102 | setup do | |
|
103 | Role.delete_all("builtin = #{Role::BUILTIN_ANONYMOUS}") | |
|
104 | 100 |
|
|
105 | 101 | |
|
106 | should "create a new anonymous role" do | |
|
107 | assert_difference('Role.count') do | |
|
108 | Role.anonymous | |
|
109 | end | |
|
110 | end | |
|
102 | def test_anonymous_with_a_missing_anonymous_role_should_return_the_anonymous_role | |
|
103 | Role.where(:builtin => Role::BUILTIN_ANONYMOUS).delete_all | |
|
111 | 104 | |
|
112 | should "return the anonymous role" do | |
|
105 | assert_difference('Role.count') do | |
|
113 | 106 |
|
|
114 | 107 |
|
|
115 | 108 |
|
|
116 | 109 |
|
|
117 | 110 |
|
|
118 | end | |
|
119 | 111 | |
|
120 | context "#non_member" do | |
|
121 | should "return the non-member role" do | |
|
112 | def test_non_member_should_return_the_non_member_role | |
|
113 | assert_no_difference('Role.count') do | |
|
122 | 114 | role = Role.non_member |
|
123 | 115 | assert role.builtin? |
|
124 | 116 | assert_equal Role::BUILTIN_NON_MEMBER, role.builtin |
|
125 | 117 | end |
|
126 | ||
|
127 | context "with a missing non-member role" do | |
|
128 | setup do | |
|
129 | Role.delete_all("builtin = #{Role::BUILTIN_NON_MEMBER}") | |
|
130 | 118 |
|
|
131 | 119 | |
|
132 | should "create a new non-member role" do | |
|
133 | assert_difference('Role.count') do | |
|
134 | Role.non_member | |
|
135 | end | |
|
136 | end | |
|
120 | def test_non_member_with_a_missing_non_member_role_should_return_the_non_member_role | |
|
121 | Role.where(:builtin => Role::BUILTIN_NON_MEMBER).delete_all | |
|
137 | 122 | |
|
138 | should "return the non-member role" do | |
|
123 | assert_difference('Role.count') do | |
|
139 | 124 |
|
|
140 | 125 |
|
|
141 | 126 |
|
|
142 | 127 |
|
|
143 | 128 |
|
|
144 | 129 |
|
|
145 | end |
@@ -84,16 +84,13 class WikiTest < ActiveSupport::TestCase | |||
|
84 | 84 | assert_equal ja_test, Wiki.titleize(ja_test) |
|
85 | 85 | end |
|
86 | 86 | |
|
87 | context "#sidebar" do | |
|
88 | setup do | |
|
87 | def test_sidebar_should_return_nil_if_undefined | |
|
89 | 88 |
|
|
90 | end | |
|
91 | ||
|
92 | should "return nil if undefined" do | |
|
93 | 89 |
|
|
94 | 90 |
|
|
95 | 91 | |
|
96 |
|
|
|
92 | def test_sidebar_should_return_a_wiki_page_if_defined | |
|
93 | @wiki = Wiki.find(1) | |
|
97 | 94 |
|
|
98 | 95 |
|
|
99 | 96 |
|
@@ -102,4 +99,3 class WikiTest < ActiveSupport::TestCase | |||
|
102 | 99 |
|
|
103 | 100 |
|
|
104 | 101 |
|
|
105 | end |
General Comments 0
You need to be logged in to leave comments.
Login now