2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
RSpec.describe 'Commit (JavaScript fixtures)' do
|
2018-06-21 08:22:40 -04:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2020-03-26 14:08:03 -04:00
|
|
|
let_it_be(:project) { create(:project, :repository) }
|
2022-01-21 16:16:35 -05:00
|
|
|
let_it_be(:user) { project.first_owner }
|
2020-07-06 14:09:13 -04:00
|
|
|
let_it_be(:commit) { project.commit("master") }
|
2018-06-21 08:22:40 -04:00
|
|
|
|
|
|
|
before do
|
2019-02-21 11:53:53 -05:00
|
|
|
allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon')
|
2018-06-21 08:22:40 -04:00
|
|
|
end
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
after(:all) do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe Projects::CommitController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'commit/show.html' do
|
|
|
|
params = {
|
|
|
|
namespace_id: project.namespace,
|
|
|
|
project_id: project,
|
|
|
|
id: commit.id
|
|
|
|
}
|
|
|
|
|
|
|
|
get :show, params: params
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe API::Commits, '(JavaScript fixtures)', type: :request do
|
|
|
|
include ApiHelpers
|
2018-06-21 08:22:40 -04:00
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
it 'api/commits/commit.json' do
|
|
|
|
get api("/projects/#{project.id}/repository/commits/#{commit.id}", user)
|
2018-06-21 08:22:40 -04:00
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2018-06-21 08:22:40 -04:00
|
|
|
end
|
|
|
|
end
|