debian-mirror-gitlab/spec/features/projects/releases/user_views_release_spec.rb

61 lines
1.8 KiB
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'User views Release', :js do
2020-04-08 14:13:33 +05:30
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
2021-01-03 14:25:43 +05:30
let(:graphql_feature_flag) { true }
let(:release) do
create(:release,
project: project,
name: 'The first release',
description: '**Lorem** _ipsum_ dolor sit [amet](https://example.com)')
end
2020-04-08 14:13:33 +05:30
before do
2021-01-03 14:25:43 +05:30
stub_feature_flags(graphql_individual_release_page: graphql_feature_flag)
2020-04-08 14:13:33 +05:30
project.add_developer(user)
2021-01-03 14:25:43 +05:30
sign_in(user)
2020-04-08 14:13:33 +05:30
visit project_release_path(project, release)
end
2021-01-03 14:25:43 +05:30
it_behaves_like 'page meta description', 'Lorem ipsum dolor sit amet'
2020-04-08 14:13:33 +05:30
2021-01-03 14:25:43 +05:30
shared_examples 'release page' do
it 'renders the breadcrumbs' do
within('.breadcrumbs') do
expect(page).to have_content("#{project.creator.name} #{project.name} Releases #{release.name}")
expect(page).to have_link(project.creator.name, href: user_path(project.creator))
expect(page).to have_link(project.name, href: project_path(project))
expect(page).to have_link('Releases', href: project_releases_path(project))
expect(page).to have_link(release.name, href: project_release_path(project, release))
end
2020-04-08 14:13:33 +05:30
end
2021-01-03 14:25:43 +05:30
it 'renders the release details' do
within('.release-block') do
expect(page).to have_content(release.name)
expect(page).to have_content(release.tag)
expect(page).to have_content(release.commit.short_id)
expect(page).to have_content('Lorem ipsum dolor sit amet')
end
2020-04-08 14:13:33 +05:30
end
end
2021-01-03 14:25:43 +05:30
describe 'when the graphql_individual_release_page feature flag is enabled' do
it_behaves_like 'release page'
end
describe 'when the graphql_individual_release_page feature flag is disabled' do
let(:graphql_feature_flag) { false }
it_behaves_like 'release page'
end
2020-04-08 14:13:33 +05:30
end