From 2c646bb22593dc377c278622b35f79f1063725ad Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 11 Jul 2016 19:47:45 +0800 Subject: [PATCH] Move tests to respect to modules and extract artifacts tests --- spec/features/projects/artifacts_spec.rb | 31 +++++++++++++++++++++ spec/features/{ => projects}/builds_spec.rb | 17 ----------- 2 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 spec/features/projects/artifacts_spec.rb rename spec/features/{ => projects}/builds_spec.rb (93%) diff --git a/spec/features/projects/artifacts_spec.rb b/spec/features/projects/artifacts_spec.rb new file mode 100644 index 00000000000..fc6e2b07d40 --- /dev/null +++ b/spec/features/projects/artifacts_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe 'Artifacts' do + let(:artifacts_file) { fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') } + + before do + login_as(:user) + @commit = FactoryGirl.create :ci_pipeline + @build = FactoryGirl.create :ci_build, pipeline: @commit + @build2 = FactoryGirl.create :ci_build + @project = @commit.project + @project.team << [@user, :developer] + end + + describe "GET /:project/builds/:id/artifacts/download" do + before do + @build.update_attributes(artifacts_file: artifacts_file) + visit namespace_project_build_path(@project.namespace, @project, @build) + click_link 'Download' + end + + context "Build from other project" do + before do + @build2.update_attributes(artifacts_file: artifacts_file) + visit download_namespace_project_build_artifacts_path(@project.namespace, @project, @build2) + end + + it { expect(page.status_code).to eq(404) } + end + end +end diff --git a/spec/features/builds_spec.rb b/spec/features/projects/builds_spec.rb similarity index 93% rename from spec/features/builds_spec.rb rename to spec/features/projects/builds_spec.rb index 16832c297ac..25689f1c6e8 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/projects/builds_spec.rb @@ -196,23 +196,6 @@ describe "Builds" do end end - describe "GET /:project/builds/:id/download" do - before do - @build.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_build_path(@project.namespace, @project, @build) - click_link 'Download' - end - - context "Build from other project" do - before do - @build2.update_attributes(artifacts_file: artifacts_file) - visit download_namespace_project_build_artifacts_path(@project.namespace, @project, @build2) - end - - it { expect(page.status_code).to eq(404) } - end - end - describe "GET /:project/builds/:id/raw" do context "Build from project" do before do