From f91c54725e563b7f82c77e617efa354449ac150e Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 2 Sep 2014 10:44:31 +0200 Subject: [PATCH] Add a feature flip for education field update --- lib/travis/api/app/endpoint/authorization.rb | 5 ++++- spec/unit/endpoint/authorization/user_manager_spec.rb | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index 24fddbcd..5733959d 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -216,7 +216,10 @@ class Travis::Api::App def info(attributes = {}) info = data.to_hash.slice('name', 'login', 'gravatar_id') info.merge! attributes.stringify_keys - info['education'] = education + if Travis::Features.feature_active?(:education_data_sync) || + (user && Travis::Features.owner_active?(:education_data_sync, user)) + info['education'] = education + end info['github_id'] ||= data['id'] info end diff --git a/spec/unit/endpoint/authorization/user_manager_spec.rb b/spec/unit/endpoint/authorization/user_manager_spec.rb index 5e48ec0b..4b5b5c04 100644 --- a/spec/unit/endpoint/authorization/user_manager_spec.rb +++ b/spec/unit/endpoint/authorization/user_manager_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe Travis::Api::App::Endpoint::Authorization::UserManager do let(:manager) { described_class.new(data, 'abc123') } + before do + Travis::Features.enable_for_all(:education_data_sync) + end + describe '#info' do let(:data) { {