|
1 |
require File.expand_path('../../test_helper', __FILE__)
|
|
2 |
|
|
3 |
class WikiTest < Redmine::IntegrationTest
|
|
4 |
fixtures :projects,
|
|
5 |
:users, :email_addresses,
|
|
6 |
:roles,
|
|
7 |
:members,
|
|
8 |
:member_roles,
|
|
9 |
:trackers,
|
|
10 |
:projects_trackers,
|
|
11 |
:enabled_modules,
|
|
12 |
:wikis,
|
|
13 |
:wiki_pages,
|
|
14 |
:wiki_contents
|
|
15 |
|
|
16 |
def test_updating_a_renamed_page
|
|
17 |
log_user('jsmith', 'jsmith')
|
|
18 |
|
|
19 |
get '/projects/ecookbook/wiki'
|
|
20 |
assert_response :success
|
|
21 |
|
|
22 |
get '/projects/ecookbook/wiki/Wiki/edit'
|
|
23 |
assert_response :success
|
|
24 |
|
|
25 |
# this update should not end up with a loss of content
|
|
26 |
put '/projects/ecookbook/wiki/Wiki', params: {
|
|
27 |
content: {
|
|
28 |
text: "# Wiki\r\n\r\ncontent", comments:""
|
|
29 |
},
|
|
30 |
wiki_page: { parent_id: "" }
|
|
31 |
}
|
|
32 |
assert_redirected_to "/projects/ecookbook/wiki/Wiki"
|
|
33 |
follow_redirect!
|
|
34 |
assert_select 'div', /content/
|
|
35 |
assert content = WikiContent.last
|
|
36 |
|
|
37 |
# Let's assume somebody else, or the same user in another tab, renames the
|
|
38 |
# page while it is being edited.
|
|
39 |
post '/projects/ecookbook/wiki/Wiki/rename', params: { wiki_page: { title: "NewTitle" } }
|
|
40 |
assert_redirected_to "/projects/ecookbook/wiki/NewTitle"
|
|
41 |
|
|
42 |
# this update should not end up with a loss of content
|
|
43 |
put '/projects/ecookbook/wiki/Wiki', params: {
|
|
44 |
content: {
|
|
45 |
version: content.version, text: "# Wiki\r\n\r\nnew content", comments:""
|
|
46 |
},
|
|
47 |
wiki_page: { parent_id: "" }
|
|
48 |
}
|
|
49 |
|
|
50 |
assert_redirected_to "/projects/ecookbook/wiki/NewTitle"
|
|
51 |
follow_redirect!
|
|
52 |
assert_select 'div', /new content/
|
|
53 |
end
|
|
54 |
|
|
55 |
end
|
|
56 |
|