From 2cfea4d67df109818e4d339819aa4bad36c0451e Mon Sep 17 00:00:00 2001 From: vitalie Date: Thu, 29 Dec 2022 21:08:56 +0200 Subject: [PATCH] Fix specs --- Gemfile.lock | 2 +- spec/v3/queries/custom_key_spec.rb | 10 +++++----- spec/v3/services/custom_keys/create_spec.rb | 3 +-- spec/v3/services/installation/find_spec.rb | 1 + spec/v3/services/organization/find_spec.rb | 6 ++++-- .../organizations/for_current_user_spec.rb | 3 ++- spec/v3/services/owner/find_spec.rb | 16 +++++++++++++--- spec/v3/services/user/current_spec.rb | 1 + spec/v3/services/user/find_spec.rb | 1 + .../services/v2_subscription/executions_spec.rb | 1 + 10 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2589b5bf32..2d07ff3358 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -325,7 +325,7 @@ GEM rb-fsevent (0.9.8) rb-inotify (0.10.1) ffi (~> 1.0) - rbtrace (0.4.12) + rbtrace (0.4.14) ffi (>= 1.0.6) msgpack (>= 0.4.3) optimist (>= 3.0.0) diff --git a/spec/v3/queries/custom_key_spec.rb b/spec/v3/queries/custom_key_spec.rb index 6aa5c7ec2e..14e5b3eedb 100644 --- a/spec/v3/queries/custom_key_spec.rb +++ b/spec/v3/queries/custom_key_spec.rb @@ -16,7 +16,7 @@ context 'key with identifier does not exist in user or organization' do it 'creates custom key' do - expect(described_class.new({}, 'CustomKey').create(params).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') + expect(described_class.new({}, 'CustomKey').create(params, user).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') end end @@ -33,7 +33,7 @@ end it 'returns error' do - expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity) + expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity) end end @@ -53,7 +53,7 @@ end it 'returns error' do - expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity) + expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity) end end end @@ -75,7 +75,7 @@ context 'key with identifier does not exist in user or organization' do it 'creates custom key' do - expect(described_class.new({}, 'CustomKey').create(params).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') + expect(described_class.new({}, 'CustomKey').create(params, user).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') end end @@ -92,7 +92,7 @@ end it 'returns error' do - expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity) + expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity) end end end diff --git a/spec/v3/services/custom_keys/create_spec.rb b/spec/v3/services/custom_keys/create_spec.rb index 1feadf4c97..3ecaae6fa7 100644 --- a/spec/v3/services/custom_keys/create_spec.rb +++ b/spec/v3/services/custom_keys/create_spec.rb @@ -26,10 +26,9 @@ describe "creating custom key" do before { post('/v3/custom_keys', options, headers) } - example { expect(parsed_body).to eql_json({ + example { expect(parsed_body.except("id")).to eql_json({ "@type" => "custom_key", "@representation" => "standard", - "id" => 1, "name" => "TEST_KEY", "description" => "", "public_key" => diff --git a/spec/v3/services/installation/find_spec.rb b/spec/v3/services/installation/find_spec.rb index 9462d0ba16..7db97f122f 100644 --- a/spec/v3/services/installation/find_spec.rb +++ b/spec/v3/services/installation/find_spec.rb @@ -62,6 +62,7 @@ "@type" => "allowance", "id" => 1 }, + "custom_keys" => [], "allow_migration" => false, "recently_signed_up" => false, "secure_user_hash" => nil, diff --git a/spec/v3/services/organization/find_spec.rb b/spec/v3/services/organization/find_spec.rb index f93bb1a5b3..fd62a9c60a 100644 --- a/spec/v3/services/organization/find_spec.rb +++ b/spec/v3/services/organization/find_spec.rb @@ -28,7 +28,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }} end @@ -63,7 +64,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }} end diff --git a/spec/v3/services/organizations/for_current_user_spec.rb b/spec/v3/services/organizations/for_current_user_spec.rb index b60480f37d..a554f7453d 100644 --- a/spec/v3/services/organizations/for_current_user_spec.rb +++ b/spec/v3/services/organizations/for_current_user_spec.rb @@ -64,7 +64,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }] }} end diff --git a/spec/v3/services/owner/find_spec.rb b/spec/v3/services/owner/find_spec.rb index ffc531639d..2c36ef8a20 100644 --- a/spec/v3/services/owner/find_spec.rb +++ b/spec/v3/services/owner/find_spec.rb @@ -28,7 +28,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }} end @@ -54,7 +55,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }} end @@ -86,6 +88,7 @@ "@representation" => "minimal", "id" => org.id }, + "custom_keys" => [], "repositories" => [{ "@type" => "repository", "@href" => "/v3/repo/#{repo.id}", @@ -162,6 +165,7 @@ "@representation" => "minimal", "id" => org.id }, + "custom_keys" => [], "repositories" => [{ "@type" => "repository", "@href" => "/v3/repo/#{repo.id}", @@ -232,7 +236,8 @@ "@type" => "allowance", "@representation" => "minimal", "id" => org.id - } + }, + "custom_keys" => [] }} end @@ -263,6 +268,7 @@ "@representation" => "minimal", "id" => org.id }, + "custom_keys" => [], "@warnings" => [{ "@type" => "warning", "message" => "query parameter organization.id not safelisted, ignored", @@ -302,6 +308,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => false, @@ -334,6 +341,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => false, @@ -366,6 +374,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => false, @@ -402,6 +411,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => false, diff --git a/spec/v3/services/user/current_spec.rb b/spec/v3/services/user/current_spec.rb index 9ba1a367d6..7dd8bc1c40 100644 --- a/spec/v3/services/user/current_spec.rb +++ b/spec/v3/services/user/current_spec.rb @@ -30,6 +30,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => true, diff --git a/spec/v3/services/user/find_spec.rb b/spec/v3/services/user/find_spec.rb index 5639d24680..b544918ccf 100644 --- a/spec/v3/services/user/find_spec.rb +++ b/spec/v3/services/user/find_spec.rb @@ -42,6 +42,7 @@ "@representation" => "minimal", "id" => user.id }, + "custom_keys" => [], "recently_signed_up"=>false, "secure_user_hash" => nil, "ro_mode" => false, diff --git a/spec/v3/services/v2_subscription/executions_spec.rb b/spec/v3/services/v2_subscription/executions_spec.rb index df5c5647ca..2a0d433435 100644 --- a/spec/v3/services/v2_subscription/executions_spec.rb +++ b/spec/v3/services/v2_subscription/executions_spec.rb @@ -175,6 +175,7 @@ "@representation"=>"minimal", "id"=>1 }, + "custom_keys" => [], "email"=>"sven@fuchs.com", "is_syncing"=>nil, "synced_at"=>nil,