Commit 1b683006 authored by Eugenia Grieff's avatar Eugenia Grieff Committed by Dmytro Zaporozhets (DZ)

Fix project import data spec

We need a persisted user for the project because it is used in some
specs
parent 81ff89a6
......@@ -5,9 +5,11 @@ require 'spec_helper'
RSpec.describe ProjectImportData do
using RSpec::Parameterized::TableSyntax
let_it_be(:user) { create(:user) }
let(:import_url) { 'ssh://example.com' }
let(:import_data_attrs) { { auth_method: 'ssh_public_key' } }
let(:project) { build(:project, :mirror, import_url: import_url, import_data_attributes: import_data_attrs) }
let(:project) { build(:project, :mirror, creator: user, import_url: import_url, import_data_attributes: import_data_attrs) }
subject(:import_data) { project.import_data }
......@@ -33,8 +35,6 @@ RSpec.describe ProjectImportData do
end
describe '#ssh_known_hosts_verified_by' do
let(:user) { project.owner }
subject { import_data.ssh_known_hosts_verified_by }
it 'is a user when ssh_known_hosts_verified_by_id is a valid id' do
......
......@@ -270,11 +270,11 @@ RSpec.describe Project do
describe 'setting up a mirror' do
context 'when new project' do
it 'creates import_state and sets next_execution_timestamp to now' do
project = build(:project, :mirror)
project = build(:project, :mirror, creator: create(:user))
Timecop.freeze do
expect do
project.save
project.save!
end.to change { ProjectImportState.count }.by(1)
expect(project.import_state.next_execution_timestamp).to be_like_time(Time.current)
......
......@@ -22,11 +22,12 @@ RSpec.describe StorageHelper do
end
describe "#storage_counters_details" do
let(:namespace) { create :namespace }
let(:project) do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) do
create(:project,
namespace: namespace,
statistics: build(:project_statistics,
namespace: namespace,
repository_size: 10.kilobytes,
wiki_size: 10.bytes,
lfs_objects_size: 20.gigabytes,
......
......@@ -175,12 +175,13 @@ RSpec.describe Namespace do
end
describe '.with_statistics' do
let(:namespace) { create :namespace }
let_it_be(:namespace) { create(:namespace) }
let(:project1) do
create(:project,
namespace: namespace,
statistics: build(:project_statistics,
namespace: namespace,
repository_size: 101,
wiki_size: 505,
lfs_objects_size: 202,
......@@ -193,6 +194,7 @@ RSpec.describe Namespace do
create(:project,
namespace: namespace,
statistics: build(:project_statistics,
namespace: namespace,
repository_size: 10,
wiki_size: 50,
lfs_objects_size: 20,
......
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