diff options
Diffstat (limited to 'spec/lib/gitlab/github_import/representation/protected_branch_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/representation/protected_branch_spec.rb | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/spec/lib/gitlab/github_import/representation/protected_branch_spec.rb b/spec/lib/gitlab/github_import/representation/protected_branch_spec.rb index e762dc469c1..30b29659eee 100644 --- a/spec/lib/gitlab/github_import/representation/protected_branch_spec.rb +++ b/spec/lib/gitlab/github_import/representation/protected_branch_spec.rb @@ -9,24 +9,47 @@ RSpec.describe Gitlab::GithubImport::Representation::ProtectedBranch do end context 'with ProtectedBranch' do - it 'includes the protected branch ID (name)' do + it 'includes the protected branch ID (name) attribute' do expect(protected_branch.id).to eq 'main' end - it 'includes the protected branch allow_force_pushes' do + it 'includes the protected branch allow_force_pushes attribute' do expect(protected_branch.allow_force_pushes).to eq true end + + it 'includes the protected branch required_conversation_resolution attribute' do + expect(protected_branch.required_conversation_resolution).to eq true + end + + it 'includes the protected branch required_pull_request_reviews' do + expect(protected_branch.required_pull_request_reviews).to eq true + end end end describe '.from_api_response' do let(:response) do - response = Struct.new(:url, :allow_force_pushes, keyword_init: true) - allow_force_pushes = Struct.new(:enabled, keyword_init: true) + response = Struct.new( + :url, :allow_force_pushes, :required_conversation_resolution, :required_signatures, + :required_pull_request_reviews, + keyword_init: true + ) + enabled_setting = Struct.new(:enabled, keyword_init: true) + required_pull_request_reviews = Struct.new(:url, :dismissal_restrictions, keyword_init: true) response.new( url: 'https://example.com/branches/main/protection', - allow_force_pushes: allow_force_pushes.new( + allow_force_pushes: enabled_setting.new( + enabled: true + ), + required_conversation_resolution: enabled_setting.new( + enabled: true + ), + required_signatures: enabled_setting.new( enabled: true + ), + required_pull_request_reviews: required_pull_request_reviews.new( + url: 'https://example.com/branches/main/protection/required_pull_request_reviews', + dismissal_restrictions: {} ) ) end @@ -41,7 +64,10 @@ RSpec.describe Gitlab::GithubImport::Representation::ProtectedBranch do let(:hash) do { 'id' => 'main', - 'allow_force_pushes' => true + 'allow_force_pushes' => true, + 'required_conversation_resolution' => true, + 'required_signatures' => true, + 'required_pull_request_reviews' => true } end |