Fix PUT /users/:id and add integration test for it
This commit is contained in:
parent
d17439513f
commit
4f33a93769
|
@ -7,7 +7,7 @@ module Travis::Api::App::Responders
|
|||
def apply
|
||||
# TODO add caching headers depending on the resource
|
||||
data = result
|
||||
flash.concat(data.messages) if data && resource.respond_to?(:messages)
|
||||
flash.concat(data.messages) if data && data.respond_to?(:messages)
|
||||
data
|
||||
end
|
||||
|
||||
|
|
15
spec/integration/v2/users_spec.rb
Normal file
15
spec/integration/v2/users_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'Users' do
|
||||
let(:user) { Factory(:user, locale: 'en') }
|
||||
let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: -1) }
|
||||
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json', 'HTTP_AUTHORIZATION' => "token #{token}" } }
|
||||
|
||||
it 'GET /workers' do
|
||||
params = {user: {id: user.id, locale: 'pl'}}
|
||||
response = put "/users/#{user.id}", params, headers
|
||||
response.should be_successful
|
||||
user.reload.locale.should == 'pl'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user