summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-04-28 14:28:47 +0000
committerGo MAEDA <maeda@farend.jp>2019-04-28 14:28:47 +0000
commit2a80dbfb7626434be94628fb2bf0be774cd0f1f1 (patch)
treea5f2ef5344d2edfab6a5279a939c7ddee4723ce1
parentbb436c5be22f5e5e339552fd173d96954332c4ae (diff)
downloadredmine-2a80dbfb7626434be94628fb2bf0be774cd0f1f1.tar.gz
redmine-2a80dbfb7626434be94628fb2bf0be774cd0f1f1.zip
Test for r18091 (#26237).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18092 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/fixtures/versions.yml1
-rw-r--r--test/integration/api_test/versions_test.rb20
2 files changed, 20 insertions, 1 deletions
diff --git a/test/fixtures/versions.yml b/test/fixtures/versions.yml
index 3b59a2feb..8312666e4 100644
--- a/test/fixtures/versions.yml
+++ b/test/fixtures/versions.yml
@@ -19,6 +19,7 @@ versions_002:
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
status: locked
sharing: 'none'
+ wiki_page_title: ECookBookV1
versions_003:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"
diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb
index 2589d4f32..02fed75d0 100644
--- a/test/integration/api_test/versions_test.rb
+++ b/test/integration/api_test/versions_test.rb
@@ -71,6 +71,22 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
assert_select 'version id', :text => version.id.to_s
end
+ test "POST /projects/:project_id/versions.xml should create the version with wiki page title" do
+ assert_difference 'Version.count' do
+ post '/projects/1/versions.xml',
+ :params => {:version => {:name => 'API test', :wiki_page_title => WikiPage.first.title}},
+ :headers => credentials('jsmith')
+ end
+
+ version = Version.order('id DESC').first
+ assert_equal 'API test', version.name
+ assert_equal WikiPage.first, version.wiki_page
+
+ assert_response :created
+ assert_equal 'application/xml', @response.content_type
+ assert_select 'version id', :text => version.id.to_s
+ end
+
test "POST /projects/:project_id/versions.xml should create the version with custom fields" do
field = VersionCustomField.generate!
@@ -116,17 +132,19 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
assert_select 'id', :text => '2'
assert_select 'name', :text => '1.0'
assert_select 'sharing', :text => 'none'
+ assert_select 'wiki_page_title', :text => 'ECookBookV1'
end
end
test "PUT /versions/:id.xml should update the version" do
put '/versions/2.xml',
- :params => {:version => {:name => 'API update'}},
+ :params => {:version => {:name => 'API update', :wiki_page_title => WikiPage.first.title}},
:headers => credentials('jsmith')
assert_response :no_content
assert_equal '', @response.body
assert_equal 'API update', Version.find(2).name
+ assert_equal WikiPage.first, Version.find(2).wiki_page
end
test "DELETE /versions/:id.xml should destroy the version" do