Commit bbd2ce88 authored by Axel García's avatar Axel García

Add backend tests for #new epic page

parent 3375aefb
......@@ -27,6 +27,12 @@ RSpec.describe Groups::EpicsController do
it_behaves_like '404 status'
end
describe 'GET #new' do
subject { get :new, params: { group_id: group } }
it_behaves_like '404 status'
end
describe 'GET #show' do
subject { get :show, params: { group_id: group, id: epic.to_param } }
......@@ -248,6 +254,23 @@ RSpec.describe Groups::EpicsController do
end
end
describe 'GET #new' do
it 'renders template' do
group.add_developer(user)
get :new, params: { group_id: group }
expect(response).to render_template 'groups/epics/new'
end
context 'with unauthorized user' do
it 'returns a not found 404 response' do
get :new, params: { group_id: group }
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
describe 'GET #show' do
def show_epic(format = :html)
get :show, params: { group_id: group, id: epic.to_param }, format: format
......
......@@ -5,6 +5,23 @@ require 'spec_helper'
RSpec.describe EpicsHelper, type: :helper do
include ApplicationHelper
describe '#epic_new_app_data' do
let(:group) { create(:group) }
it 'returns the correct data for a new epic' do
expected_data = {
group_path: group.full_path,
group_epics_path: "/groups/#{group.full_path}/-/epics",
labels_fetch_path: "/groups/#{group.full_path}/-/labels.json?include_ancestor_groups=true&only_group_labels=true",
labels_manage_path: "/groups/#{group.full_path}/-/labels",
markdown_preview_path: "/groups/#{group.full_path}/preview_markdown",
markdown_docs_path: help_page_path('user/markdown')
}
expect(helper.epic_new_app_data(group)).to match(hash_including(expected_data))
end
end
describe '#epic_endpoint_query_params' do
let(:endpoint_data) do
{
......
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