2021-10-27 15:23:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe JiraConnect::AppDataSerializer do
|
|
|
|
describe '#as_json' do
|
2023-07-09 08:55:56 +05:30
|
|
|
subject(:app_data_json) { described_class.new(subscriptions).as_json }
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
let_it_be(:subscriptions) { create_list(:jira_connect_subscription, 2) }
|
|
|
|
|
|
|
|
it 'uses the subscription entity' do
|
|
|
|
expect(JiraConnect::SubscriptionEntity).to receive(:represent).with(subscriptions)
|
|
|
|
|
|
|
|
app_data_json
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes a group path with already subscribed namespaces as skip_groups' do
|
|
|
|
expected_path = "/api/v4/groups?min_access_level=40&skip_groups%5B%5D=#{subscriptions.first.namespace_id}&skip_groups%5B%5D=#{subscriptions.last.namespace_id}"
|
|
|
|
|
|
|
|
expect(app_data_json).to include(groups_path: expected_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to include(subscriptions_path: '/-/jira_connect/subscriptions') }
|
|
|
|
end
|
|
|
|
end
|