mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 22:05:56 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user