@@ -126,6 +126,23 LOREM | |||
|
126 | 126 | assert_template 'new' |
|
127 | 127 | end |
|
128 | 128 | |
|
129 | def test_create_non_default_category | |
|
130 | @request.session[:user_id] = 2 | |
|
131 | category2 = Enumeration.find_by_name('User documentation') | |
|
132 | category2.update_attributes(:is_default => true) | |
|
133 | category1 = Enumeration.find_by_name('Uncategorized') | |
|
134 | post :create, | |
|
135 | :project_id => 'ecookbook', | |
|
136 | :document => { :title => 'no default', | |
|
137 | :description => 'This is a new document', | |
|
138 | :category_id => category1.id } | |
|
139 | assert_redirected_to '/projects/ecookbook/documents' | |
|
140 | doc = Document.find_by_title('no default') | |
|
141 | assert_not_nil doc | |
|
142 | assert_equal category1.id, doc.category_id | |
|
143 | assert_equal category1, doc.category | |
|
144 | end | |
|
145 | ||
|
129 | 146 | def test_edit |
|
130 | 147 | @request.session[:user_id] = 2 |
|
131 | 148 | get :edit, :id => 1 |
General Comments 0
You need to be logged in to leave comments.
Login now