Commit a3a63eeb authored by Robert Speicher's avatar Robert Speicher

Remove all instances to 'gitlabhq_x' seed repositories from specs and features

We now need only one seed repo! Also cleans up the seeding script.
parent a39cfb54
# create tmp dir if not exist require 'fileutils'
tmp_dir = File.join(Rails.root, "tmp")
Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir) print "Unpacking seed repository..."
# Create dir for test repo SEED_REPO = 'seed_project.tar.gz'
repo_dir = File.join(Rails.root, "tmp", "tests") REPO_PATH = File.join(Rails.root, 'tmp', 'repositories')
Dir.mkdir(repo_dir) unless File.exists?(repo_dir)
# Make whatever directories we need to make
`cp spec/seed_project.tar.gz tmp/tests/` FileUtils.mkdir_p(REPO_PATH)
Dir.chdir(repo_dir)
`tar -xf seed_project.tar.gz` # Copy the archive to the repo path
3.times do |i| FileUtils.cp(File.join(Rails.root, 'spec', SEED_REPO), REPO_PATH)
`cp -r gitlabhq/ gitlabhq_#{i}/`
puts "Unpacked seed repo - tmp/tests/gitlabhq_#{i}" # chdir to the repo path
FileUtils.cd(REPO_PATH) do
# Extract the archive
`tar -xf #{SEED_REPO}`
# Remove the copy
FileUtils.rm(SEED_REPO)
end end
puts ' done.'
...@@ -106,13 +106,9 @@ Given /^I have assigned issues$/ do ...@@ -106,13 +106,9 @@ Given /^I have assigned issues$/ do
end end
Given /^I have authored merge requests$/ do Given /^I have authored merge requests$/ do
project1 = Factory :project, project1 = Factory :project
:path => "gitlabhq_1",
:code => "gitlabhq_1"
project2 = Factory :project, project2 = Factory :project
:path => "gitlabhq_2",
:code => "gitlabhq_2"
project1.add_access(@user, :read, :write) project1.add_access(@user, :read, :write)
project2.add_access(@user, :read, :write) project2.add_access(@user, :read, :write)
......
...@@ -85,7 +85,7 @@ describe Project do ...@@ -85,7 +85,7 @@ describe Project do
it "should return path to repo" do it "should return path to repo" do
project = Project.new(path: "somewhere") project = Project.new(path: "somewhere")
project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") project.path_to_repo.should == File.join(Rails.root, "tmp", "repositories", "somewhere")
end end
it "returns the full web URL for this repo" do it "returns the full web URL for this repo" do
......
...@@ -87,7 +87,7 @@ describe "Admin::Projects" do ...@@ -87,7 +87,7 @@ describe "Admin::Projects" do
visit new_admin_project_path visit new_admin_project_path
fill_in 'project_name', with: 'NewProject' fill_in 'project_name', with: 'NewProject'
fill_in 'project_code', with: 'NPR' fill_in 'project_code', with: 'NPR'
fill_in 'project_path', with: 'gitlabhq_1' fill_in 'project_path', with: 'newproject'
expect { click_button "Create project" }.to change { Project.count }.by(1) expect { click_button "Create project" }.to change { Project.count }.by(1)
@project = Project.last @project = Project.last
end end
......
...@@ -6,13 +6,9 @@ describe "User Issues Dashboard" do ...@@ -6,13 +6,9 @@ describe "User Issues Dashboard" do
login_as :user login_as :user
@project1 = Factory :project, @project1 = Factory :project
path: "gitlabhq_0",
code: "TEST1"
@project2 = Factory :project, @project2 = Factory :project
path: "gitlabhq_1",
code: "TEST2"
@project1.add_access(@user, :read, :write) @project1.add_access(@user, :read, :write)
@project2.add_access(@user, :read, :write) @project2.add_access(@user, :read, :write)
......
...@@ -17,11 +17,11 @@ module StubbedRepository ...@@ -17,11 +17,11 @@ module StubbedRepository
if new_record? || path == 'newproject' if new_record? || path == 'newproject'
# There are a couple Project specs and features that expect the Project's # There are a couple Project specs and features that expect the Project's
# path to be in the returned path, so let's patronize them. # path to be in the returned path, so let's patronize them.
File.join(Rails.root, 'tmp', 'tests', path) File.join(Rails.root, 'tmp', 'repositories', path)
else else
# For everything else, just give it the path to one of our real seeded # For everything else, just give it the path to one of our real seeded
# repos. # repos.
File.join(Rails.root, 'tmp', 'tests', 'gitlabhq_0') File.join(Rails.root, 'tmp', 'repositories', 'gitlabhq')
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