2021-11-18 22:05:49 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Projects::ClusterAgentsHelper do
|
|
|
|
describe '#js_cluster_agent_details_data' do
|
|
|
|
let_it_be(:project) { create(:project) }
|
2022-04-04 11:22:00 +05:30
|
|
|
let_it_be(:current_user) { create(:user) }
|
2021-11-18 22:05:49 +05:30
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
let(:user_can_admin_vulerability) { true }
|
2021-11-18 22:05:49 +05:30
|
|
|
let(:agent_name) { 'agent-name' }
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
before do
|
|
|
|
allow(helper).to receive(:current_user).and_return(current_user)
|
|
|
|
allow(helper)
|
|
|
|
.to receive(:can?)
|
|
|
|
.with(current_user, :admin_vulnerability, project)
|
|
|
|
.and_return(user_can_admin_vulerability)
|
2021-11-18 22:05:49 +05:30
|
|
|
end
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
subject { helper.js_cluster_agent_details_data(agent_name, project) }
|
2022-03-02 08:16:31 +05:30
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
it {
|
|
|
|
is_expected.to match({
|
|
|
|
agent_name: agent_name,
|
|
|
|
project_path: project.full_path,
|
|
|
|
activity_empty_state_image: kind_of(String),
|
|
|
|
empty_state_svg_path: kind_of(String),
|
|
|
|
can_admin_vulnerability: "true"
|
|
|
|
})
|
|
|
|
}
|
2021-11-18 22:05:49 +05:30
|
|
|
end
|
|
|
|
end
|