Description:
add announcement controller test
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r642:a8976e9a07cd - - 2 files changed: 4 inserted, 4 deleted
@@ -111,6 +111,6 | |||
|
111 | 111 | private |
|
112 | 112 | |
|
113 | 113 | def announcement_params |
|
114 |
- params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only,:title |
|
|
114 | + params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title) | |
|
115 | 115 | end |
|
116 | 116 | end |
@@ -3,7 +3,7 | |||
|
3 | 3 | class AnnouncementsControllerTest < ActionController::TestCase |
|
4 | 4 | setup do |
|
5 | 5 | @announcement = announcements(:one) |
|
6 | - @request.session[:user_id] = user(:admin).id | |
|
6 | + @request.session[:user_id] = users(:admin).id | |
|
7 | 7 | end |
|
8 | 8 | |
|
9 | 9 | test "should get index" do |
@@ -19,7 +19,7 | |||
|
19 | 19 | |
|
20 | 20 | test "should create announcement" do |
|
21 | 21 | assert_difference('Announcement.count') do |
|
22 | - post :create, announcement: { } | |
|
22 | + post :create, announcement: { author: 'aa',body: 'bb', published: true, frontpage: true, title: 'test'} | |
|
23 | 23 | end |
|
24 | 24 | |
|
25 | 25 | assert_redirected_to announcement_path(assigns(:announcement)) |
@@ -36,7 +36,7 | |||
|
36 | 36 | end |
|
37 | 37 | |
|
38 | 38 | test "should update announcement" do |
|
39 | - patch :update, id: @announcement, announcement: { } | |
|
39 | + patch :update, id: @announcement, announcement: { author: 'aa',body: 'bb', published: true, frontpage: true, title: 'test'} | |
|
40 | 40 | assert_redirected_to announcement_path(assigns(:announcement)) |
|
41 | 41 | end |
|
42 | 42 |
You need to be logged in to leave comments.
Login now