Use Rails 5 syntax for integration tests.

git-svn-id: http://svn.redmine.org/redmine/trunk@16586 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2017-06-01 18:17:27 +00:00
parent b834e81d7f
commit 966f238da4
31 changed files with 700 additions and 398 deletions

View File

@@ -23,12 +23,13 @@ class Redmine::ApiTest::ApiTest < Redmine::ApiTest::Base
def test_api_should_work_with_protect_from_forgery
ActionController::Base.allow_forgery_protection = true
assert_difference('User.count') do
post '/users.xml', {
:user => {
:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname',
:mail => 'foo@example.net', :password => 'secret123'}
},
credentials('admin')
post '/users.xml',
:params => {
:user => {
:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname',
:mail => 'foo@example.net', :password => 'secret123'}
},
:headers => credentials('admin')
assert_response 201
end
ensure
@@ -36,17 +37,17 @@ class Redmine::ApiTest::ApiTest < Redmine::ApiTest::Base
end
def test_json_datetime_format
get '/users/1.json', {}, credentials('admin')
get '/users/1.json', :headers => credentials('admin')
assert_include '"created_on":"2006-07-19T17:12:21Z"', response.body
end
def test_xml_datetime_format
get '/users/1.xml', {}, credentials('admin')
get '/users/1.xml', :headers => credentials('admin')
assert_include '<created_on>2006-07-19T17:12:21Z</created_on>', response.body
end
def test_head_response_should_have_empty_body
put '/users/7.xml', {:user => {:login => 'foo'}}, credentials('admin')
put '/users/7.xml', :params => {:user => {:login => 'foo'}}, :headers => credentials('admin')
assert_response :ok
assert_equal '', response.body