diff options
Diffstat (limited to 'spec/lib/api/entities/project_job_token_scope_spec.rb')
-rw-r--r-- | spec/lib/api/entities/project_job_token_scope_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/api/entities/project_job_token_scope_spec.rb b/spec/lib/api/entities/project_job_token_scope_spec.rb new file mode 100644 index 00000000000..cceef9e7f30 --- /dev/null +++ b/spec/lib/api/entities/project_job_token_scope_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::API::Entities::ProjectJobTokenScope, feature_category: :secrets_management do + let_it_be(:project) do + create(:project, + :public, + ci_inbound_job_token_scope_enabled: true, + ci_outbound_job_token_scope_enabled: true + ) + end + + let_it_be(:current_user) { create(:user) } + + let(:options) { { current_user: current_user } } + let(:entity) { described_class.new(project, options) } + + describe "#as_json" do + subject { entity.as_json } + + it 'includes basic fields' do + expect(subject).to eq( + inbound_enabled: true, + outbound_enabled: true + ) + end + + it 'includes basic fields' do + project.update!(ci_inbound_job_token_scope_enabled: false) + + expect(subject).to eq( + inbound_enabled: false, + outbound_enabled: true + ) + end + end +end |