Commit e315bf2e authored by Coung Ngo's avatar Coung Ngo

Improve project iterations tests

Improve tests as a result of reviewer feedback
parent 0541f67a
- return unless Feature.enabled?(:project_iterations, @project.group, default_enabled: false)
- return unless @project.feature_available?(:iterations)
- return unless can?(current_user, :read_iteration, @project)
= nav_link(controller: :iterations) do
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::IterationsController do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
context 'index' do
context 'when iterations license is not available' do
before do
stub_licensed_features(iterations: false)
sign_in(user)
get :index, params: { namespace_id: project.namespace, project_id: project }
end
it 'renders 404' do
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when user is unauthorized' do
before do
sign_in(user)
get :index, params: { namespace_id: project.namespace, project_id: project }
end
it 'renders 404' do
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when user is authorized' do
before do
project.add_developer(user)
sign_in(user)
get :index, params: { namespace_id: project.namespace, project_id: project }
end
it 'renders index successfully' do
expect(response).to be_successful
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment