Commit a3a63eeb92f5cc660dc3f03e2d7249e4b5f04acf
1 parent
a39cfb54
Exists in
master
and in
4 other branches
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.
Showing
6 changed files
with
30 additions
and
30 deletions
Show diff stats
db/fixtures/test/001_repo.rb
1 | -# create tmp dir if not exist | |
2 | -tmp_dir = File.join(Rails.root, "tmp") | |
3 | -Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir) | |
4 | - | |
5 | -# Create dir for test repo | |
6 | -repo_dir = File.join(Rails.root, "tmp", "tests") | |
7 | -Dir.mkdir(repo_dir) unless File.exists?(repo_dir) | |
8 | - | |
9 | -`cp spec/seed_project.tar.gz tmp/tests/` | |
10 | -Dir.chdir(repo_dir) | |
11 | -`tar -xf seed_project.tar.gz` | |
12 | -3.times do |i| | |
13 | -`cp -r gitlabhq/ gitlabhq_#{i}/` | |
14 | -puts "Unpacked seed repo - tmp/tests/gitlabhq_#{i}" | |
1 | +require 'fileutils' | |
2 | + | |
3 | +print "Unpacking seed repository..." | |
4 | + | |
5 | +SEED_REPO = 'seed_project.tar.gz' | |
6 | +REPO_PATH = File.join(Rails.root, 'tmp', 'repositories') | |
7 | + | |
8 | +# Make whatever directories we need to make | |
9 | +FileUtils.mkdir_p(REPO_PATH) | |
10 | + | |
11 | +# Copy the archive to the repo path | |
12 | +FileUtils.cp(File.join(Rails.root, 'spec', SEED_REPO), REPO_PATH) | |
13 | + | |
14 | +# chdir to the repo path | |
15 | +FileUtils.cd(REPO_PATH) do | |
16 | + # Extract the archive | |
17 | + `tar -xf #{SEED_REPO}` | |
18 | + | |
19 | + # Remove the copy | |
20 | + FileUtils.rm(SEED_REPO) | |
15 | 21 | end |
22 | + | |
23 | +puts ' done.' | ... | ... |
features/step_definitions/dashboard_steps.rb
... | ... | @@ -106,13 +106,9 @@ Given /^I have assigned issues$/ do |
106 | 106 | end |
107 | 107 | |
108 | 108 | Given /^I have authored merge requests$/ do |
109 | - project1 = Factory :project, | |
110 | - :path => "gitlabhq_1", | |
111 | - :code => "gitlabhq_1" | |
109 | + project1 = Factory :project | |
112 | 110 | |
113 | - project2 = Factory :project, | |
114 | - :path => "gitlabhq_2", | |
115 | - :code => "gitlabhq_2" | |
111 | + project2 = Factory :project | |
116 | 112 | |
117 | 113 | project1.add_access(@user, :read, :write) |
118 | 114 | project2.add_access(@user, :read, :write) | ... | ... |
spec/models/project_spec.rb
... | ... | @@ -85,7 +85,7 @@ describe Project do |
85 | 85 | |
86 | 86 | it "should return path to repo" do |
87 | 87 | project = Project.new(path: "somewhere") |
88 | - project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") | |
88 | + project.path_to_repo.should == File.join(Rails.root, "tmp", "repositories", "somewhere") | |
89 | 89 | end |
90 | 90 | |
91 | 91 | it "returns the full web URL for this repo" do | ... | ... |
spec/requests/admin/admin_projects_spec.rb
... | ... | @@ -87,7 +87,7 @@ describe "Admin::Projects" do |
87 | 87 | visit new_admin_project_path |
88 | 88 | fill_in 'project_name', with: 'NewProject' |
89 | 89 | fill_in 'project_code', with: 'NPR' |
90 | - fill_in 'project_path', with: 'gitlabhq_1' | |
90 | + fill_in 'project_path', with: 'newproject' | |
91 | 91 | expect { click_button "Create project" }.to change { Project.count }.by(1) |
92 | 92 | @project = Project.last |
93 | 93 | end | ... | ... |
spec/requests/atom/dashboard_issues_spec.rb
... | ... | @@ -6,13 +6,9 @@ describe "User Issues Dashboard" do |
6 | 6 | |
7 | 7 | login_as :user |
8 | 8 | |
9 | - @project1 = Factory :project, | |
10 | - path: "gitlabhq_0", | |
11 | - code: "TEST1" | |
9 | + @project1 = Factory :project | |
12 | 10 | |
13 | - @project2 = Factory :project, | |
14 | - path: "gitlabhq_1", | |
15 | - code: "TEST2" | |
11 | + @project2 = Factory :project | |
16 | 12 | |
17 | 13 | @project1.add_access(@user, :read, :write) |
18 | 14 | @project2.add_access(@user, :read, :write) | ... | ... |
spec/support/stubbed_repository.rb
... | ... | @@ -17,11 +17,11 @@ module StubbedRepository |
17 | 17 | if new_record? || path == 'newproject' |
18 | 18 | # There are a couple Project specs and features that expect the Project's |
19 | 19 | # path to be in the returned path, so let's patronize them. |
20 | - File.join(Rails.root, 'tmp', 'tests', path) | |
20 | + File.join(Rails.root, 'tmp', 'repositories', path) | |
21 | 21 | else |
22 | 22 | # For everything else, just give it the path to one of our real seeded |
23 | 23 | # repos. |
24 | - File.join(Rails.root, 'tmp', 'tests', 'gitlabhq_0') | |
24 | + File.join(Rails.root, 'tmp', 'repositories', 'gitlabhq') | |
25 | 25 | end |
26 | 26 | end |
27 | 27 | ... | ... |