Feature #26709 » api_test.rb.patch
api_test.rb (working copy) | ||
---|---|---|
52 | 52 |
assert_response :ok |
53 | 53 |
assert_equal '', response.body |
54 | 54 |
end |
55 | ||
56 |
def test_accept_header_on_show |
|
57 |
get '/users/1', :headers => credentials('admin').merge({'Accept' => 'application/xml'}) |
|
58 |
assert_response :ok |
|
59 |
assert_equal 'application/xml', response.content_type |
|
60 |
assert_include '<?xml', response.body |
|
61 |
end |
|
62 | ||
63 |
def test_accept_header_on_create |
|
64 |
put '/users/7', :params => '<user><login>foo</login></user>', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'}) |
|
65 |
assert_response :ok |
|
66 |
assert_equal 'application/xml', response.content_type |
|
67 |
assert_equal User.find(7).login, 'foo' |
|
68 |
end |
|
69 | ||
70 |
def test_accept_header_on_error |
|
71 |
put '/users/7', :params => '<user><login></login></user>', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'}) |
|
72 |
assert_response 422 |
|
73 |
assert_equal 'application/xml', response.content_type |
|
74 |
assert_include '<?xml', response.body |
|
75 |
assert_include '<error>', response.body |
|
76 |
end |
|
55 | 77 |
end |
- « Previous
- 1
- 2
- 3
- Next »