debian-mirror-gitlab/spec/frontend/fixtures/commit.rb

57 lines
1.2 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'Commit (JavaScript fixtures)' do
2018-11-08 19:23:39 +05:30
include JavaScriptFixturesHelpers
2020-04-22 19:07:51 +05:30
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
2020-07-28 23:09:34 +05:30
let_it_be(:commit) { project.commit("master") }
2018-11-08 19:23:39 +05:30
before(:all) do
clean_frontend_fixtures('commit/')
2020-07-28 23:09:34 +05:30
clean_frontend_fixtures('api/commits/')
project.add_maintainer(user)
2018-11-08 19:23:39 +05:30
end
before do
2019-07-07 11:18:12 +05:30
allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon')
2018-11-08 19:23:39 +05:30
end
2020-07-28 23:09:34 +05:30
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-11-08 19:23:39 +05:30
2020-07-28 23:09:34 +05:30
it 'api/commits/commit.json' do
get api("/projects/#{project.id}/repository/commits/#{commit.id}", user)
2018-11-08 19:23:39 +05:30
2020-07-28 23:09:34 +05:30
expect(response).to be_successful
end
2018-11-08 19:23:39 +05:30
end
end