File: deploy_key_helper_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (28 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require "spec_helper"

RSpec.describe Admin::DeployKeyHelper do
  describe '#admin_deploy_keys_data' do
    let_it_be(:edit_path) { '/admin/deploy_keys/:id/edit' }
    let_it_be(:delete_path) { '/admin/deploy_keys/:id' }
    let_it_be(:create_path) { '/admin/deploy_keys/new' }
    let_it_be(:empty_state_svg_path) { '/assets/illustrations/empty-state/empty-access-token-md.svg' }

    subject(:result) { helper.admin_deploy_keys_data }

    it 'returns correct hash' do
      expect(helper).to receive(:edit_admin_deploy_key_path).with(':id').and_return(edit_path)
      expect(helper).to receive(:admin_deploy_key_path).with(':id').and_return(delete_path)
      expect(helper).to receive(:new_admin_deploy_key_path).and_return(create_path)
      expect(helper).to receive(:image_path).with('illustrations/empty-state/empty-access-token-md.svg').and_return(empty_state_svg_path)

      expect(result).to eq({
        edit_path: edit_path,
        delete_path: delete_path,
        create_path: create_path,
        empty_state_svg_path: empty_state_svg_path
      })
    end
  end
end