Description:
- fix login box
- add announcement functional test
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r638:b8cc2bced458 - - 6 files changed: 170 inserted, 121 deleted
@@ -0,0 +1,50 | |||
|
1 | + require 'test_helper' | |
|
2 | + | |
|
3 | + class AnnouncementsControllerTest < ActionController::TestCase | |
|
4 | + setup do | |
|
5 | + @announcement = announcements(:one) | |
|
6 | + @request.session[:user_id] = users(:admin).id | |
|
7 | + end | |
|
8 | + | |
|
9 | + test "should get index" do | |
|
10 | + get :index | |
|
11 | + assert_response :success | |
|
12 | + assert_not_nil assigns(:announcements) | |
|
13 | + end | |
|
14 | + | |
|
15 | + test "should get new" do | |
|
16 | + get :new | |
|
17 | + assert_response :success | |
|
18 | + end | |
|
19 | + | |
|
20 | + test "should create announcement" do | |
|
21 | + assert_difference('Announcement.count') do | |
|
22 | + post :create, announcement: { author: 'test', body: 'haha', published: true} | |
|
23 | + end | |
|
24 | + | |
|
25 | + assert_redirected_to announcement_path(assigns(:announcement)) | |
|
26 | + end | |
|
27 | + | |
|
28 | + test "should show announcement" do | |
|
29 | + get :show, id: @announcement | |
|
30 | + assert_response :success | |
|
31 | + end | |
|
32 | + | |
|
33 | + test "should get edit" do | |
|
34 | + get :edit, id: @announcement | |
|
35 | + assert_response :success | |
|
36 | + end | |
|
37 | + | |
|
38 | + test "should update announcement" do | |
|
39 | + patch :update, id: @announcement, announcement: { body: 'another body' } | |
|
40 | + assert_redirected_to announcement_path(assigns(:announcement)) | |
|
41 | + end | |
|
42 | + | |
|
43 | + test "should destroy announcement" do | |
|
44 | + assert_difference('Announcement.count', -1) do | |
|
45 | + delete :destroy, id: @announcement | |
|
46 | + end | |
|
47 | + | |
|
48 | + assert_redirected_to announcements_path | |
|
49 | + end | |
|
50 | + end |
@@ -0,0 +1,7 | |||
|
1 | + require 'test_helper' | |
|
2 | + | |
|
3 | + class AdminTaskTest < ActionDispatch::IntegrationTest | |
|
4 | + # test "the truth" do | |
|
5 | + # assert true | |
|
6 | + # end | |
|
7 | + end |
@@ -102,33 +102,31 | |||
|
102 | 102 | return false |
|
103 | 103 | end |
|
104 | 104 | unless user.last_ip |
|
105 | 105 | user.last_ip = request.remote_ip |
|
106 | 106 | user.save |
|
107 | 107 | end |
|
108 | 108 | end |
|
109 | 109 | return true |
|
110 | 110 | end |
|
111 | 111 | |
|
112 | 112 | def authorization |
|
113 | 113 | return false unless authenticate |
|
114 | - puts "haha 1" | |
|
115 | 114 | user = User.find(session[:user_id]) |
|
116 | 115 | unless user.roles.detect { |role| |
|
117 | 116 | role.rights.detect{ |right| |
|
118 | 117 | right.controller == self.class.controller_name and |
|
119 | 118 | (right.action == 'all' or right.action == action_name) |
|
120 | 119 | } |
|
121 | 120 | } |
|
122 | - puts "haha 2" | |
|
123 | 121 | flash[:notice] = 'You are not authorized to view the page you requested' |
|
124 | 122 | #request.env['HTTP_REFERER'] ? (redirect_to :back) : (redirect_to :controller => 'login') |
|
125 | 123 | redirect_to :controller => 'main', :action => 'login' |
|
126 | 124 | return false |
|
127 | 125 | end |
|
128 | 126 | end |
|
129 | 127 | |
|
130 | 128 | def verify_time_limit |
|
131 | 129 | return true if session[:user_id]==nil |
|
132 | 130 | user = User.find(session[:user_id], :include => :site) |
|
133 | 131 | return true if user==nil or user.site == nil |
|
134 | 132 | if user.contest_finished? |
@@ -1,25 +1,23 | |||
|
1 | 1 | %b= GraderConfiguration['ui.front.welcome_message'] |
|
2 | 2 | %br/ |
|
3 | 3 | |
|
4 | 4 | - if !@hidelogin |
|
5 | 5 | =t 'login.message' |
|
6 | 6 | %br/ |
|
7 | 7 | %br/ |
|
8 | 8 | |
|
9 | - - puts flash.inspect | |
|
10 | 9 | - if flash[:notice] |
|
11 | 10 | %hr/ |
|
12 | 11 | %b= flash[:notice] |
|
13 | - %b= haha | |
|
14 | 12 | %hr/ |
|
15 | 13 | |
|
16 | 14 | %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"} |
|
17 | 15 | = form_tag login_login_path do |
|
18 | 16 | %table |
|
19 | 17 | %tr |
|
20 | 18 | %td{:align => "right"} |
|
21 | 19 | ="#{t 'login_label'}:" |
|
22 | 20 | %td= text_field_tag 'login' |
|
23 | 21 | %tr |
|
24 | 22 | %td{:align => "right"} |
|
25 | 23 | ="#{t 'password_label'}:" |
@@ -5,277 +5,266 | |||
|
5 | 5 | # |
|
6 | 6 | # Note that this schema.rb definition is the authoritative source for your |
|
7 | 7 | # database schema. If you need to create the application database on another |
|
8 | 8 | # system, you should be using db:schema:load, not running all the migrations |
|
9 | 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
10 | 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
11 | 11 | # |
|
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
|
13 | 13 | |
|
14 | 14 | ActiveRecord::Schema.define(version: 20170124024527) do |
|
15 | 15 | |
|
16 | 16 | create_table "announcements", force: :cascade do |t| |
|
17 |
- t.string "author" |
|
|
18 |
- t.text "body" |
|
|
17 | + t.string "author" | |
|
18 | + t.text "body" | |
|
19 | 19 | t.boolean "published" |
|
20 | 20 |
t.datetime "created_at", |
|
21 | 21 |
t.datetime "updated_at", |
|
22 | 22 |
t.boolean "frontpage", |
|
23 | 23 |
t.boolean "contest_only", |
|
24 |
- t.string "title" |
|
|
25 |
- t.string "notes" |
|
|
24 | + t.string "title" | |
|
25 | + t.string "notes" | |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | create_table "contests", force: :cascade do |t| |
|
29 |
- t.string "title" |
|
|
29 | + t.string "title" | |
|
30 | 30 | t.boolean "enabled" |
|
31 | 31 |
t.datetime "created_at", |
|
32 | 32 |
t.datetime "updated_at", |
|
33 |
- t.string "name" |
|
|
33 | + t.string "name" | |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | create_table "contests_problems", id: false, force: :cascade do |t| |
|
37 |
- t.integer "contest_id" |
|
|
38 |
- t.integer "problem_id" |
|
|
37 | + t.integer "contest_id" | |
|
38 | + t.integer "problem_id" | |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | create_table "contests_users", id: false, force: :cascade do |t| |
|
42 |
- t.integer "contest_id" |
|
|
43 |
- t.integer "user_id" |
|
|
42 | + t.integer "contest_id" | |
|
43 | + t.integer "user_id" | |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | create_table "countries", force: :cascade do |t| |
|
47 |
- t.string "name" |
|
|
47 | + t.string "name" | |
|
48 | 48 |
t.datetime "created_at", |
|
49 | 49 |
t.datetime "updated_at", |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | create_table "descriptions", force: :cascade do |t| |
|
53 |
- t.text "body" |
|
|
53 | + t.text "body" | |
|
54 | 54 | t.boolean "markdowned" |
|
55 | 55 |
t.datetime "created_at", |
|
56 | 56 |
t.datetime "updated_at", |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | create_table "grader_configurations", force: :cascade do |t| |
|
60 |
- t.string "key" |
|
|
61 |
- t.string "value_type" |
|
|
62 |
- t.string "value" |
|
|
60 | + t.string "key" | |
|
61 | + t.string "value_type" | |
|
62 | + t.string "value" | |
|
63 | 63 |
t.datetime "created_at", |
|
64 | 64 |
t.datetime "updated_at", |
|
65 |
- t.text "description" |
|
|
65 | + t.text "description" | |
|
66 | 66 | end |
|
67 | 67 | |
|
68 | 68 | create_table "grader_processes", force: :cascade do |t| |
|
69 |
- t.string "host" |
|
|
70 |
- t.integer "pid" |
|
|
71 |
- t.string "mode" |
|
|
69 | + t.string "host" | |
|
70 | + t.integer "pid" | |
|
71 | + t.string "mode" | |
|
72 | 72 | t.boolean "active" |
|
73 | 73 |
t.datetime "created_at", |
|
74 | 74 |
t.datetime "updated_at", |
|
75 |
- t.integer "task_id" |
|
|
76 |
- t.string "task_type" |
|
|
75 | + t.integer "task_id" | |
|
76 | + t.string "task_type" | |
|
77 | 77 | t.boolean "terminated" |
|
78 | 78 | end |
|
79 | 79 | |
|
80 |
- add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid" |
|
|
80 | + add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid" | |
|
81 | 81 | |
|
82 | 82 | create_table "heart_beats", force: :cascade do |t| |
|
83 |
- t.integer "user_id" |
|
|
84 |
- t.string "ip_address" |
|
|
83 | + t.integer "user_id" | |
|
84 | + t.string "ip_address" | |
|
85 | 85 |
t.datetime "created_at", |
|
86 | 86 |
t.datetime "updated_at", |
|
87 |
- t.string "status" |
|
|
87 | + t.string "status" | |
|
88 | 88 | end |
|
89 | 89 | |
|
90 |
- add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
|
90 | + add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at" | |
|
91 | 91 | |
|
92 | 92 | create_table "languages", force: :cascade do |t| |
|
93 | 93 | t.string "name", limit: 10 |
|
94 |
- t.string "pretty_name" |
|
|
94 | + t.string "pretty_name" | |
|
95 | 95 | t.string "ext", limit: 10 |
|
96 |
- t.string "common_ext" |
|
|
96 | + t.string "common_ext" | |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | create_table "logins", force: :cascade do |t| |
|
100 |
- t.integer "user_id" |
|
|
101 |
- t.string "ip_address" |
|
|
100 | + t.integer "user_id" | |
|
101 | + t.string "ip_address" | |
|
102 | 102 |
t.datetime "created_at", |
|
103 | 103 |
t.datetime "updated_at", |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | create_table "messages", force: :cascade do |t| |
|
107 |
- t.integer "sender_id" |
|
|
108 |
- t.integer "receiver_id" |
|
|
109 |
- t.integer "replying_message_id" |
|
|
110 | - t.text "body", limit: 65535 | |
|
107 | + t.integer "sender_id" | |
|
108 | + t.integer "receiver_id" | |
|
109 | + t.integer "replying_message_id" | |
|
110 | + t.text "body" | |
|
111 | 111 | t.boolean "replied" |
|
112 | 112 |
t.datetime "created_at", |
|
113 | 113 |
t.datetime "updated_at", |
|
114 | 114 | end |
|
115 | 115 | |
|
116 | - create_table "problems", force: :cascade do |t| | |
|
117 | - t.string "name", limit: 30 | |
|
118 | - t.string "full_name", limit: 255 | |
|
119 | - t.integer "full_score", limit: 4 | |
|
120 | - t.date "date_added" | |
|
121 | - t.boolean "available" | |
|
122 | - t.string "url", limit: 255 | |
|
123 | - t.integer "description_id", limit: 4 | |
|
124 | - t.boolean "test_allowed" | |
|
125 | - t.boolean "output_only" | |
|
126 | - t.string "description_filename", limit: 255 | |
|
127 | - t.boolean "view_testcase" | |
|
128 | - end | |
|
116 | + # Could not dump table "problems" because of following NoMethodError | |
|
117 | + # undefined method `[]' for nil:NilClass | |
|
129 | 118 | |
|
130 | 119 | create_table "rights", force: :cascade do |t| |
|
131 |
- t.string "name" |
|
|
132 |
- t.string "controller" |
|
|
133 |
- t.string "action" |
|
|
120 | + t.string "name" | |
|
121 | + t.string "controller" | |
|
122 | + t.string "action" | |
|
134 | 123 | end |
|
135 | 124 | |
|
136 | 125 | create_table "rights_roles", id: false, force: :cascade do |t| |
|
137 |
- t.integer "right_id" |
|
|
138 |
- t.integer "role_id" |
|
|
126 | + t.integer "right_id" | |
|
127 | + t.integer "role_id" | |
|
139 | 128 | end |
|
140 | 129 | |
|
141 |
- add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id" |
|
|
130 | + add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id" | |
|
142 | 131 | |
|
143 | 132 | create_table "roles", force: :cascade do |t| |
|
144 |
- t.string "name" |
|
|
133 | + t.string "name" | |
|
145 | 134 | end |
|
146 | 135 | |
|
147 | 136 | create_table "roles_users", id: false, force: :cascade do |t| |
|
148 |
- t.integer "role_id" |
|
|
149 |
- t.integer "user_id" |
|
|
137 | + t.integer "role_id" | |
|
138 | + t.integer "user_id" | |
|
150 | 139 | end |
|
151 | 140 | |
|
152 |
- add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id" |
|
|
141 | + add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id" | |
|
153 | 142 | |
|
154 | 143 | create_table "sessions", force: :cascade do |t| |
|
155 |
- t.string "session_id" |
|
|
156 |
- t.text "data" |
|
|
144 | + t.string "session_id" | |
|
145 | + t.text "data" | |
|
157 | 146 | t.datetime "updated_at" |
|
158 | 147 | end |
|
159 | 148 | |
|
160 |
- add_index "sessions", ["session_id"], name: "index_sessions_on_session_id" |
|
|
161 |
- add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at" |
|
|
149 | + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id" | |
|
150 | + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at" | |
|
162 | 151 | |
|
163 | 152 | create_table "sites", force: :cascade do |t| |
|
164 |
- t.string "name" |
|
|
153 | + t.string "name" | |
|
165 | 154 | t.boolean "started" |
|
166 | 155 | t.datetime "start_time" |
|
167 | 156 |
t.datetime "created_at", |
|
168 | 157 |
t.datetime "updated_at", |
|
169 |
- t.integer "country_id" |
|
|
170 |
- t.string "password" |
|
|
158 | + t.integer "country_id" | |
|
159 | + t.string "password" | |
|
171 | 160 | end |
|
172 | 161 | |
|
173 | 162 | create_table "submission_view_logs", force: :cascade do |t| |
|
174 |
- t.integer "user_id" |
|
|
175 |
- t.integer "submission_id" |
|
|
163 | + t.integer "user_id" | |
|
164 | + t.integer "submission_id" | |
|
176 | 165 |
t.datetime "created_at", |
|
177 | 166 |
t.datetime "updated_at", |
|
178 | 167 | end |
|
179 | 168 | |
|
180 | 169 | create_table "submissions", force: :cascade do |t| |
|
181 |
- t.integer "user_id" |
|
|
182 |
- t.integer "problem_id" |
|
|
183 |
- t.integer "language_id" |
|
|
184 |
- t.text "source" |
|
|
185 |
- t.binary "binary" |
|
|
170 | + t.integer "user_id" | |
|
171 | + t.integer "problem_id" | |
|
172 | + t.integer "language_id" | |
|
173 | + t.text "source" | |
|
174 | + t.binary "binary" | |
|
186 | 175 | t.datetime "submitted_at" |
|
187 | 176 | t.datetime "compiled_at" |
|
188 |
- t.text "compiler_message" |
|
|
177 | + t.text "compiler_message" | |
|
189 | 178 | t.datetime "graded_at" |
|
190 |
- t.integer "points" |
|
|
191 |
- t.text "grader_comment" |
|
|
192 |
- t.integer "number" |
|
|
193 |
- t.string "source_filename" |
|
|
194 |
- t.float "max_runtime" |
|
|
195 |
- t.integer "peak_memory" |
|
|
196 |
- t.integer "effective_code_length" |
|
|
197 |
- t.string "ip_address" |
|
|
179 | + t.integer "points" | |
|
180 | + t.text "grader_comment" | |
|
181 | + t.integer "number" | |
|
182 | + t.string "source_filename" | |
|
183 | + t.float "max_runtime" | |
|
184 | + t.integer "peak_memory" | |
|
185 | + t.integer "effective_code_length" | |
|
186 | + t.string "ip_address" | |
|
198 | 187 | end |
|
199 | 188 | |
|
200 |
- add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true |
|
|
201 |
- add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" |
|
|
189 | + add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true | |
|
190 | + add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" | |
|
202 | 191 | |
|
203 | 192 | create_table "tasks", force: :cascade do |t| |
|
204 |
- t.integer "submission_id" |
|
|
193 | + t.integer "submission_id" | |
|
205 | 194 | t.datetime "created_at" |
|
206 |
- t.integer "status" |
|
|
195 | + t.integer "status" | |
|
207 | 196 | t.datetime "updated_at" |
|
208 | 197 | end |
|
209 | 198 | |
|
210 | 199 | create_table "test_pairs", force: :cascade do |t| |
|
211 |
- t.integer "problem_id" |
|
|
200 | + t.integer "problem_id" | |
|
212 | 201 | t.text "input", limit: 16777215 |
|
213 | 202 | t.text "solution", limit: 16777215 |
|
214 | 203 | t.datetime "created_at", null: false |
|
215 | 204 | t.datetime "updated_at", null: false |
|
216 | 205 | end |
|
217 | 206 | |
|
218 | 207 | create_table "test_requests", force: :cascade do |t| |
|
219 |
- t.integer "user_id" |
|
|
220 |
- t.integer "problem_id" |
|
|
221 |
- t.integer "submission_id" |
|
|
222 |
- t.string "input_file_name" |
|
|
223 |
- t.string "output_file_name" |
|
|
224 |
- t.string "running_stat" |
|
|
225 |
- t.integer "status" |
|
|
208 | + t.integer "user_id" | |
|
209 | + t.integer "problem_id" | |
|
210 | + t.integer "submission_id" | |
|
211 | + t.string "input_file_name" | |
|
212 | + t.string "output_file_name" | |
|
213 | + t.string "running_stat" | |
|
214 | + t.integer "status" | |
|
226 | 215 |
t.datetime "updated_at", |
|
227 | 216 | t.datetime "submitted_at" |
|
228 | 217 | t.datetime "compiled_at" |
|
229 |
- t.text "compiler_message" |
|
|
218 | + t.text "compiler_message" | |
|
230 | 219 | t.datetime "graded_at" |
|
231 |
- t.string "grader_comment" |
|
|
220 | + t.string "grader_comment" | |
|
232 | 221 |
t.datetime "created_at", |
|
233 |
- t.float "running_time" |
|
|
234 |
- t.string "exit_status" |
|
|
235 |
- t.integer "memory_usage" |
|
|
222 | + t.float "running_time" | |
|
223 | + t.string "exit_status" | |
|
224 | + t.integer "memory_usage" | |
|
236 | 225 | end |
|
237 | 226 | |
|
238 |
- add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" |
|
|
227 | + add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" | |
|
239 | 228 | |
|
240 | 229 | create_table "testcases", force: :cascade do |t| |
|
241 |
- t.integer "problem_id" |
|
|
242 |
- t.integer "num" |
|
|
243 |
- t.integer "group" |
|
|
244 |
- t.integer "score" |
|
|
230 | + t.integer "problem_id" | |
|
231 | + t.integer "num" | |
|
232 | + t.integer "group" | |
|
233 | + t.integer "score" | |
|
245 | 234 | t.text "input", limit: 4294967295 |
|
246 | 235 | t.text "sol", limit: 4294967295 |
|
247 | - t.datetime "created_at" | |
|
248 | - t.datetime "updated_at" | |
|
236 | + t.datetime "created_at", null: false | |
|
237 | + t.datetime "updated_at", null: false | |
|
249 | 238 | end |
|
250 | 239 | |
|
251 |
- add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id" |
|
|
240 | + add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id" | |
|
252 | 241 | |
|
253 | 242 | create_table "user_contest_stats", force: :cascade do |t| |
|
254 |
- t.integer "user_id" |
|
|
243 | + t.integer "user_id" | |
|
255 | 244 | t.datetime "started_at" |
|
256 | 245 |
t.datetime "created_at", |
|
257 | 246 |
t.datetime "updated_at", |
|
258 | 247 | t.boolean "forced_logout" |
|
259 | 248 | end |
|
260 | 249 | |
|
261 | 250 | create_table "users", force: :cascade do |t| |
|
262 | 251 | t.string "login", limit: 50 |
|
263 |
- t.string "full_name" |
|
|
264 |
- t.string "hashed_password" |
|
|
252 | + t.string "full_name" | |
|
253 | + t.string "hashed_password" | |
|
265 | 254 | t.string "salt", limit: 5 |
|
266 |
- t.string "alias" |
|
|
267 |
- t.string "email" |
|
|
268 |
- t.integer "site_id" |
|
|
269 |
- t.integer "country_id" |
|
|
255 | + t.string "alias" | |
|
256 | + t.string "email" | |
|
257 | + t.integer "site_id" | |
|
258 | + t.integer "country_id" | |
|
270 | 259 |
t.boolean "activated", |
|
271 | 260 | t.datetime "created_at" |
|
272 | 261 | t.datetime "updated_at" |
|
273 | 262 |
t.boolean "enabled", |
|
274 |
- t.string "remark" |
|
|
275 |
- t.string "last_ip" |
|
|
276 |
- t.string "section" |
|
|
263 | + t.string "remark" | |
|
264 | + t.string "last_ip" | |
|
265 | + t.string "section" | |
|
277 | 266 | end |
|
278 | 267 | |
|
279 |
- add_index "users", ["login"], name: "index_users_on_login", unique: true |
|
|
268 | + add_index "users", ["login"], name: "index_users_on_login", unique: true | |
|
280 | 269 | |
|
281 | 270 | end |
@@ -1,20 +1,27 | |||
|
1 | 1 | ENV["RAILS_ENV"] = "test" |
|
2 | 2 | require File.expand_path('../../config/environment', __FILE__) |
|
3 | 3 | require 'rails/test_help' |
|
4 | 4 | |
|
5 | - #reporter | |
|
5 | + #reporter for beautiful result | |
|
6 | 6 | require "minitest/reporters" |
|
7 | 7 | Minitest::Reporters.use! |
|
8 | 8 | |
|
9 | + module SignInHelper | |
|
10 | + def sign_in_as(user,password) | |
|
11 | + post login_login_path, {login: user, password: password } | |
|
12 | + end | |
|
13 | + end | |
|
14 | + | |
|
9 | 15 | class ActiveSupport::TestCase |
|
16 | + include SignInHelper | |
|
10 | 17 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. |
|
11 | 18 | # |
|
12 | 19 | # Note: You'll currently still have to declare fixtures explicitly in integration tests |
|
13 | 20 | # -- they do not yet inherit this setting |
|
14 | 21 | fixtures :all |
|
15 | 22 | |
|
16 | 23 | # Add more helper methods to be used by all tests here... |
|
17 | 24 | |
|
18 | 25 | self.use_transactional_fixtures = true |
|
19 | 26 | self.use_instantiated_fixtures = false |
|
20 | 27 | end |
You need to be logged in to leave comments.
Login now