add a test that demonstrates the change to the query on this branch supports the old params and the new v3 namespace params, and add the dirty flag for json column updates

This commit is contained in:
Renée Hendricksen 2016-08-23 03:26:01 -04:00
parent 3585a52ba5
commit ddc6a3704e
2 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,8 @@ module Travis::API::V3
end end
def update(settings = {}) def update(settings = {})
repository.user_settings.update(settings) repository.settings = repository.user_settings.update(settings).to_json
repository.settings_will_change!
repository.save! repository.save!
end end
end end

View File

@ -91,7 +91,7 @@ describe Travis::API::V3::Services::Settings, set_app: true do
end end
describe 'authenticated, existing repo' do describe 'authenticated, existing repo' do
let(:params) { JSON.dump('settings.build_pushes' => false) } let(:params) { JSON.dump('settings.build_pushes' => false, 'maximum_number_of_builds' => 4) }
before do before do
repo.update_attributes(settings: JSON.dump('maximum_number_of_builds' => 20)) repo.update_attributes(settings: JSON.dump('maximum_number_of_builds' => 20))
@ -105,8 +105,9 @@ describe Travis::API::V3::Services::Settings, set_app: true do
'builds_only_with_travis_yml' => false, 'builds_only_with_travis_yml' => false,
'build_pushes' => false, 'build_pushes' => false,
'build_pull_requests' => true, 'build_pull_requests' => true,
'maximum_number_of_builds' => 20 'maximum_number_of_builds' => 4
) )
expect(repo.reload.user_settings.maximum_number_of_builds).to eq(4)
end end
end end
end end