diff --git a/lib/travis/api/app/responders/service.rb b/lib/travis/api/app/responders/service.rb index b045c498..aeda92ea 100644 --- a/lib/travis/api/app/responders/service.rb +++ b/lib/travis/api/app/responders/service.rb @@ -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 diff --git a/spec/integration/v2/users_spec.rb b/spec/integration/v2/users_spec.rb new file mode 100644 index 00000000..4032855b --- /dev/null +++ b/spec/integration/v2/users_spec.rb @@ -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 +