diff options
Diffstat (limited to 'spec/serializers/runner_entity_spec.rb')
| -rw-r--r-- | spec/serializers/runner_entity_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/serializers/runner_entity_spec.rb b/spec/serializers/runner_entity_spec.rb index f34cb794834..b94e1e225ed 100644 --- a/spec/serializers/runner_entity_spec.rb +++ b/spec/serializers/runner_entity_spec.rb @@ -22,5 +22,23 @@ RSpec.describe RunnerEntity do expect(subject).to include(:edit_path) expect(subject).to include(:short_sha) end + + context 'without admin permissions' do + it 'does not contain admin_path field' do + expect(subject).not_to include(:admin_path) + end + end + + context 'with admin permissions' do + let_it_be(:user) { create(:user, :admin) } + + before do + allow(user).to receive(:can_admin_all_resources?).and_return(true) + end + + it 'contains admin_path field' do + expect(subject).to include(:admin_path) + end + end end end |
