Description:
fix user update
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r639:2826fdf23cce - - 2 files changed: 4 inserted, 4 deleted
@@ -541,15 +541,15 | |||||
|
541 | num_passed += 1 if sc[i][1] |
|
541 | num_passed += 1 if sc[i][1] |
|
542 | end |
|
542 | end |
|
543 | end |
|
543 | end |
|
544 | row << total |
|
544 | row << total |
|
545 | row << num_passed |
|
545 | row << num_passed |
|
546 | csv << row |
|
546 | csv << row |
|
547 | end |
|
547 | end |
|
548 | end |
|
548 | end |
|
549 | end |
|
549 | end |
|
550 |
|
550 | ||
|
551 | private |
|
551 | private |
|
552 | def user_params |
|
552 | def user_params |
|
553 | - params.require(:user).permit(:login,:full_name,:hashed_password,:salt,:alias,:email,:site_id,:country_id,:activated,:enabled,:remark,:last_ip,:section) |
|
553 | + params.require(:user).permit(:login,:password,:password_confirmation,:email, :alias, :full_name,:remark) |
|
554 | end |
|
554 | end |
|
555 | end |
|
555 | end |
@@ -1,50 +1,50 | |||||
|
1 | require 'test_helper' |
|
1 | require 'test_helper' |
|
2 |
|
2 | ||
|
3 | class AnnouncementsControllerTest < ActionController::TestCase |
|
3 | class AnnouncementsControllerTest < ActionController::TestCase |
|
4 | setup do |
|
4 | setup do |
|
5 | @announcement = announcements(:one) |
|
5 | @announcement = announcements(:one) |
|
6 |
- @request.session[:user_id] = user |
|
6 | + @request.session[:user_id] = user(:admin).id |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | test "should get index" do |
|
9 | test "should get index" do |
|
10 | get :index |
|
10 | get :index |
|
11 | assert_response :success |
|
11 | assert_response :success |
|
12 | assert_not_nil assigns(:announcements) |
|
12 | assert_not_nil assigns(:announcements) |
|
13 | end |
|
13 | end |
|
14 |
|
14 | ||
|
15 | test "should get new" do |
|
15 | test "should get new" do |
|
16 | get :new |
|
16 | get :new |
|
17 | assert_response :success |
|
17 | assert_response :success |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
20 | test "should create announcement" do |
|
20 | test "should create announcement" do |
|
21 | assert_difference('Announcement.count') do |
|
21 | assert_difference('Announcement.count') do |
|
22 |
- post :create, announcement: { |
|
22 | + post :create, announcement: { } |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
25 | assert_redirected_to announcement_path(assigns(:announcement)) |
|
25 | assert_redirected_to announcement_path(assigns(:announcement)) |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | test "should show announcement" do |
|
28 | test "should show announcement" do |
|
29 | get :show, id: @announcement |
|
29 | get :show, id: @announcement |
|
30 | assert_response :success |
|
30 | assert_response :success |
|
31 | end |
|
31 | end |
|
32 |
|
32 | ||
|
33 | test "should get edit" do |
|
33 | test "should get edit" do |
|
34 | get :edit, id: @announcement |
|
34 | get :edit, id: @announcement |
|
35 | assert_response :success |
|
35 | assert_response :success |
|
36 | end |
|
36 | end |
|
37 |
|
37 | ||
|
38 | test "should update announcement" do |
|
38 | test "should update announcement" do |
|
39 |
- patch :update, id: @announcement, announcement: { |
|
39 | + patch :update, id: @announcement, announcement: { } |
|
40 | assert_redirected_to announcement_path(assigns(:announcement)) |
|
40 | assert_redirected_to announcement_path(assigns(:announcement)) |
|
41 | end |
|
41 | end |
|
42 |
|
42 | ||
|
43 | test "should destroy announcement" do |
|
43 | test "should destroy announcement" do |
|
44 | assert_difference('Announcement.count', -1) do |
|
44 | assert_difference('Announcement.count', -1) do |
|
45 | delete :destroy, id: @announcement |
|
45 | delete :destroy, id: @announcement |
|
46 | end |
|
46 | end |
|
47 |
|
47 | ||
|
48 | assert_redirected_to announcements_path |
|
48 | assert_redirected_to announcements_path |
|
49 | end |
|
49 | end |
|
50 | end |
|
50 | end |
You need to be logged in to leave comments.
Login now