Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-05-02 12:58:35 +0300
committerJames Lopez <james@jameslopez.es>2016-05-02 12:58:35 +0300
commitb5f2a7e139f0c1803afb68c26042ce4f8cec9148 (patch)
tree1f62cf3f56a1cd0b060ff9c980410c12a3911fc5 /spec/features/projects/import_export/import_file_spec.rb
parent07ab6c2e26a36734ad29ae037810c14d2be7ec8b (diff)
fixed integration test
Diffstat (limited to 'spec/features/projects/import_export/import_file_spec.rb')
-rw-r--r--spec/features/projects/import_export/import_file_spec.rb35
1 files changed, 12 insertions, 23 deletions
diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb
index 0bc2b85edb1..05f6e289841 100644
--- a/spec/features/projects/import_export/import_file_spec.rb
+++ b/spec/features/projects/import_export/import_file_spec.rb
@@ -6,14 +6,19 @@ feature 'project import', feature: true, js: true do
let(:user) { create(:admin) }
let!(:namespace) { create(:namespace, name: "asd", owner: user) }
let(:file) { File.join(Rails.root, 'spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
-
+ let(:export_path) { "#{Dir::tmpdir}/import_file_spec" }
background do
- export_path = "#{Dir::tmpdir}/import_file_spec"
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
login_as(user)
end
+ after(:each) do
+ FileUtils.rm_rf(export_path, secure: true)
+ end
+
scenario 'user imports an exported project successfully' do
+ expect(Project.all.count).to be_zero
+
visit new_project_path
select2('2', from: '#project_namespace_id')
@@ -22,29 +27,13 @@ feature 'project import', feature: true, js: true do
expect(page).to have_content('GitLab export file')
expect(URI.parse(current_url).query).to eq('namespace_id=2&path=test-project-path')
- attach_file('file', file)
-
- #TODO check timings
- sleep 1
+ attach_file('file', file)
- click_on 'Continue to the next step'
- end
+ click_on 'Continue to the next step' # import starts
- def drop_in_dropzone(file_path)
- # Generate a fake input selector
- page.execute_script <<-JS
- var fakeFileInput = window.$('<input/>').attr(
- {id: 'fakeFileInput', type: 'file'}
- ).appendTo('body');
- JS
- # Attach the file to the fake input selector with Capybara
- attach_file("fakeFileInput", file_path)
- # Add the file to a fileList array and trigger the fake drop event
- page.execute_script <<-JS
- var fileList = [$('#fakeFileInput')[0].files[0]];
- var e = jQuery.Event('drop', { dataTransfer : { files : fileList } });
- $('.div-dropzone')[0].dropzone.listeners[0].events.drop(e);
- JS
+ expect(Project.last).not_to be_nil
+ expect(Project.last.issues).not_to be_empty
+ expect(Project.last.repo_exists?).to be true
end
end