diff --git a/spec/ci/six.tar.gz b/spec/ci/six.tar.gz deleted file mode 100644 index 80a8c6644e4c9e187a5c8f54f6cf189c76e7b122..0000000000000000000000000000000000000000 Binary files a/spec/ci/six.tar.gz and /dev/null differ diff --git a/spec/controllers/ci/projects_controller_spec.rb b/spec/controllers/ci/projects_controller_spec.rb index 0069a78251136c2d241e6bdf8bc61b1e70d383a3..9af766eff33a08f839c0fdedec93419f8cb39b8a 100644 --- a/spec/controllers/ci/projects_controller_spec.rb +++ b/spec/controllers/ci/projects_controller_spec.rb @@ -1,8 +1,8 @@ require "spec_helper" -describe ProjectsController do +describe Ci::ProjectsController do before do - @project = FactoryGirl.create :project + @project = FactoryGirl.create :ci_project end describe "POST #build" do @@ -55,25 +55,25 @@ describe ProjectsController do end let(:user) do - User.new(user_data) + Ci::User.new(user_data) end it "creates project" do allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:current_user) { user } - Network.any_instance.stub(:enable_ci).and_return(true) - Network.any_instance.stub(:project_hooks).and_return(true) + allow_any_instance_of(Ci::Network).to receive(:enable_ci).and_return(true) + allow_any_instance_of(Ci::Network).to receive(:project_hooks).and_return(true) post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access expect(response.code).to eq('302') - expect(assigns(:project)).not_to be_a_new(Project) + expect(assigns(:project)).not_to be_a_new(Ci::Project) end it "shows error" do allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:current_user) { user } - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(Ci::User).to receive(:can_manage_project?).and_return(false) post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access @@ -91,13 +91,13 @@ describe ProjectsController do end let(:user) do - User.new(user_data) + Ci::User.new(user_data) end it "searches projects" do allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:current_user) { user } - Network.any_instance.should_receive(:projects).with(hash_including(search: 'str'), :authorized) + allow_any_instance_of(Ci::Network).to receive(:projects).with(hash_including(search: 'str'), :authorized) xhr :get, :gitlab, { search: "str", format: "js" }.with_indifferent_access diff --git a/spec/factories/ci/trigger_requests.rb b/spec/factories/ci/trigger_requests.rb index c85d1027ce697de5d752777ae855e70d42a2cf33..da8b7342fcf9f697343bf7ad287659787e15413f 100644 --- a/spec/factories/ci/trigger_requests.rb +++ b/spec/factories/ci/trigger_requests.rb @@ -1,8 +1,8 @@ # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do - factory :trigger_request do - factory :trigger_request_with_variables do + factory :ci_trigger_request do + factory :ci_trigger_request_with_variables do variables do { TRIGGER_KEY: 'TRIGGER_VALUE' diff --git a/spec/factories/ci/triggers.rb b/spec/factories/ci/triggers.rb index 38cd3cbceb6e172988b45009acd91f41ff94db62..fd3afdb1ec27bb39c1bf6a12298ff25aef5153aa 100644 --- a/spec/factories/ci/triggers.rb +++ b/spec/factories/ci/triggers.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :ci_trigger_without_token, class: Ci::Trigger do - factory :trigger do + factory :ci_trigger do token 'token' end end diff --git a/spec/ci/features/admin/builds_spec.rb b/spec/features/ci/admin/builds_spec.rb similarity index 100% rename from spec/ci/features/admin/builds_spec.rb rename to spec/features/ci/admin/builds_spec.rb diff --git a/spec/ci/features/admin/events_spec.rb b/spec/features/ci/admin/events_spec.rb similarity index 100% rename from spec/ci/features/admin/events_spec.rb rename to spec/features/ci/admin/events_spec.rb diff --git a/spec/ci/features/admin/projects_spec.rb b/spec/features/ci/admin/projects_spec.rb similarity index 100% rename from spec/ci/features/admin/projects_spec.rb rename to spec/features/ci/admin/projects_spec.rb diff --git a/spec/ci/features/admin/runners_spec.rb b/spec/features/ci/admin/runners_spec.rb similarity index 100% rename from spec/ci/features/admin/runners_spec.rb rename to spec/features/ci/admin/runners_spec.rb diff --git a/spec/ci/features/builds_spec.rb b/spec/features/ci/builds_spec.rb similarity index 100% rename from spec/ci/features/builds_spec.rb rename to spec/features/ci/builds_spec.rb diff --git a/spec/ci/features/commits_spec.rb b/spec/features/ci/commits_spec.rb similarity index 100% rename from spec/ci/features/commits_spec.rb rename to spec/features/ci/commits_spec.rb diff --git a/spec/ci/features/events_spec.rb b/spec/features/ci/events_spec.rb similarity index 100% rename from spec/ci/features/events_spec.rb rename to spec/features/ci/events_spec.rb diff --git a/spec/ci/features/lint_spec.rb b/spec/features/ci/lint_spec.rb similarity index 100% rename from spec/ci/features/lint_spec.rb rename to spec/features/ci/lint_spec.rb diff --git a/spec/ci/features/projects_spec.rb b/spec/features/ci/projects_spec.rb similarity index 100% rename from spec/ci/features/projects_spec.rb rename to spec/features/ci/projects_spec.rb diff --git a/spec/ci/features/runners_spec.rb b/spec/features/ci/runners_spec.rb similarity index 100% rename from spec/ci/features/runners_spec.rb rename to spec/features/ci/runners_spec.rb diff --git a/spec/ci/features/triggers_spec.rb b/spec/features/ci/triggers_spec.rb similarity index 100% rename from spec/ci/features/triggers_spec.rb rename to spec/features/ci/triggers_spec.rb diff --git a/spec/ci/features/variables_spec.rb b/spec/features/ci/variables_spec.rb similarity index 100% rename from spec/ci/features/variables_spec.rb rename to spec/features/ci/variables_spec.rb diff --git a/spec/ci/helpers/application_helper_spec.rb b/spec/helpers/ci/application_helper_spec.rb similarity index 96% rename from spec/ci/helpers/application_helper_spec.rb rename to spec/helpers/ci/application_helper_spec.rb index c2b1058a8facf08ec9df5776575215f057a37cc2..478c0266770fdcfa0c987e2da70f921e82ed8b37 100644 --- a/spec/ci/helpers/application_helper_spec.rb +++ b/spec/helpers/ci/application_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ApplicationHelper do +describe Ci::ApplicationHelper do describe "#duration_in_words" do it "returns minutes and seconds" do intervals_in_words = { diff --git a/spec/ci/helpers/runners_helper_spec.rb b/spec/helpers/ci/runners_helper_spec.rb similarity index 94% rename from spec/ci/helpers/runners_helper_spec.rb rename to spec/helpers/ci/runners_helper_spec.rb index 02d497b40d28ec55968e8034576094422c6af1dc..e7681df10bd9f286f401292f710bf885c5ea7b10 100644 --- a/spec/ci/helpers/runners_helper_spec.rb +++ b/spec/helpers/ci/runners_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RunnersHelper do +describe Ci::RunnersHelper do it "returns - not contacted yet" do runner = FactoryGirl.build :runner runner_status_icon(runner).should include("not connected yet") diff --git a/spec/ci/helpers/user_helper_spec.rb b/spec/helpers/ci/user_helper_spec.rb similarity index 98% rename from spec/ci/helpers/user_helper_spec.rb rename to spec/helpers/ci/user_helper_spec.rb index 7215dc41a855f73dc7a4253ae73bc07d44bfb520..f95bfb355ed9c446c1abf25648718add53e73470 100644 --- a/spec/ci/helpers/user_helper_spec.rb +++ b/spec/helpers/ci/user_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe UserHelper do +describe Ci::UserHelper do describe :user_avatar_url do let (:user) { User.new({'avatar_url' => avatar_url}) } diff --git a/spec/ci/helpers/user_sessions_helper_spec.rb b/spec/helpers/ci/user_sessions_helper_spec.rb similarity index 98% rename from spec/ci/helpers/user_sessions_helper_spec.rb rename to spec/helpers/ci/user_sessions_helper_spec.rb index a2ab1f1e023df4f247bc594313e187d3b12bf647..5f654866d9935cf23600800ed9e91f47abe9b132 100644 --- a/spec/ci/helpers/user_sessions_helper_spec.rb +++ b/spec/helpers/ci/user_sessions_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe UserSessionsHelper do +describe Ci::UserSessionsHelper do describe :generate_oauth_hmac do let (:salt) { 'a' } let (:salt2) { 'b' } diff --git a/spec/ci/lib/ansi2html_spec.rb b/spec/lib/ci/ansi2html_spec.rb similarity index 100% rename from spec/ci/lib/ansi2html_spec.rb rename to spec/lib/ci/ansi2html_spec.rb diff --git a/spec/ci/lib/charts_spec.rb b/spec/lib/ci/charts_spec.rb similarity index 100% rename from spec/ci/lib/charts_spec.rb rename to spec/lib/ci/charts_spec.rb diff --git a/spec/ci/lib/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb similarity index 100% rename from spec/ci/lib/gitlab_ci_yaml_processor_spec.rb rename to spec/lib/ci/gitlab_ci_yaml_processor_spec.rb diff --git a/spec/ci/lib/upgrader_spec.rb b/spec/lib/ci/upgrader_spec.rb similarity index 100% rename from spec/ci/lib/upgrader_spec.rb rename to spec/lib/ci/upgrader_spec.rb diff --git a/spec/ci/mailers/notify_spec.rb b/spec/mailers/ci/notify_spec.rb similarity index 100% rename from spec/ci/mailers/notify_spec.rb rename to spec/mailers/ci/notify_spec.rb diff --git a/spec/ci/models/build_spec.rb b/spec/models/ci/build_spec.rb similarity index 84% rename from spec/ci/models/build_spec.rb rename to spec/models/ci/build_spec.rb index 733398176bfcd7339e6d9a5ada90bad1bd6e4e5f..d1e58438f7b780f9fe7446f525264b892f4272dd 100644 --- a/spec/ci/models/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -25,10 +25,10 @@ require 'spec_helper' -describe Build do - let(:project) { FactoryGirl.create :project } - let(:commit) { FactoryGirl.create :commit, project: project } - let(:build) { FactoryGirl.create :build, commit: commit } +describe Ci::Build do + let(:project) { FactoryGirl.create :ci_project } + let(:commit) { FactoryGirl.create :ci_commit, project: project } + let(:build) { FactoryGirl.create :ci_build, commit: commit } it { should belong_to(:commit) } it { should validate_presence_of :status } @@ -40,12 +40,12 @@ describe Build do it { should respond_to :trace_html } describe :first_pending do - let(:first) { FactoryGirl.create :build, commit: commit, status: 'pending', created_at: Date.yesterday } - let(:second) { FactoryGirl.create :build, commit: commit, status: 'pending' } + let(:first) { FactoryGirl.create :ci_build, commit: commit, status: 'pending', created_at: Date.yesterday } + let(:second) { FactoryGirl.create :ci_build, commit: commit, status: 'pending' } before { first; second } - subject { Build.first_pending } + subject { Ci::Build.first_pending } - it { should be_a(Build) } + it { should be_a(Ci::Build) } it('returns with the first pending build') { should eq(first) } end @@ -54,12 +54,12 @@ describe Build do build.status = 'success' build.save end - let(:create_from_build) { Build.create_from build } + let(:create_from_build) { Ci::Build.create_from build } it ('there should be a pending task') do - expect(Build.pending.count(:all)).to eq 0 + expect(Ci::Build.pending.count(:all)).to eq 0 create_from_build - expect(Build.pending.count(:all)).to be > 0 + expect(Ci::Build.pending.count(:all)).to be > 0 end end @@ -69,14 +69,14 @@ describe Build do context 'without started_at' do before { build.started_at = nil } - it { should be_false } + it { should be_falsey } end %w(running success failed).each do |status| context "if build status is #{status}" do before { build.status = status } - it { should be_true } + it { should be_truthy } end end @@ -84,7 +84,7 @@ describe Build do context "if build status is #{status}" do before { build.status = status } - it { should be_false } + it { should be_falsey } end end end @@ -96,7 +96,7 @@ describe Build do context "if build.status is #{state}" do before { build.status = state } - it { should be_true } + it { should be_truthy } end end @@ -104,7 +104,7 @@ describe Build do context "if build.status is #{state}" do before { build.status = state } - it { should be_false } + it { should be_falsey } end end end @@ -116,7 +116,7 @@ describe Build do context "if build.status is #{state}" do before { build.status = state } - it { should be_true } + it { should be_truthy } end end @@ -124,7 +124,7 @@ describe Build do context "if build.status is #{state}" do before { build.status = state } - it { should be_false } + it { should be_falsey } end end end @@ -138,13 +138,13 @@ describe Build do context 'and build.status is success' do before { build.status = 'success' } - it { should be_false } + it { should be_falsey } end context 'and build.status is failed' do before { build.status = 'failed' } - it { should be_false } + it { should be_falsey } end end @@ -154,13 +154,13 @@ describe Build do context 'and build.status is success' do before { build.status = 'success' } - it { should be_false } + it { should be_falsey } end context 'and build.status is failed' do before { build.status = 'failed' } - it { should be_true } + it { should be_truthy } end end end @@ -324,14 +324,14 @@ describe Build do } before do - build.project.variables << Variable.new(key: 'SECRET_KEY', value: 'secret_value') + build.project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value') end it { should eq(variables + secure_variables) } context 'and trigger variables' do - let(:trigger) { FactoryGirl.create :trigger, project: project } - let(:trigger_request) { FactoryGirl.create :trigger_request_with_variables, commit: commit, trigger: trigger } + let(:trigger) { FactoryGirl.create :ci_trigger, project: project } + let(:trigger_request) { FactoryGirl.create :ci_trigger_request_with_variables, commit: commit, trigger: trigger } let(:trigger_variables) { [ {key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false} diff --git a/spec/ci/models/commit_spec.rb b/spec/models/ci/commit_spec.rb similarity index 72% rename from spec/ci/models/commit_spec.rb rename to spec/models/ci/commit_spec.rb index 6f644d20aaf9f7ce6d3fd2c1bebf71a39e566878..6d5b0597e13152aab7f8552d92735e3390be805c 100644 --- a/spec/ci/models/commit_spec.rb +++ b/spec/models/ci/commit_spec.rb @@ -17,10 +17,10 @@ require 'spec_helper' -describe Commit do - let(:project) { FactoryGirl.create :project } - let(:commit) { FactoryGirl.create :commit, project: project } - let(:commit_with_project) { FactoryGirl.create :commit, project: project } +describe Ci::Commit do + let(:project) { FactoryGirl.create :ci_project } + let(:commit) { FactoryGirl.create :ci_commit, project: project } + let(:commit_with_project) { FactoryGirl.create :ci_commit, project: project } let(:config_processor) { GitlabCiYamlProcessor.new(gitlab_ci_yaml) } it { should belong_to(:project) } @@ -37,18 +37,18 @@ describe Commit do describe :last_build do subject { commit.last_build } before do - @first = FactoryGirl.create :build, commit: commit, created_at: Date.yesterday - @second = FactoryGirl.create :build, commit: commit + @first = FactoryGirl.create :ci_build, commit: commit, created_at: Date.yesterday + @second = FactoryGirl.create :ci_build, commit: commit end - it { should be_a(Build) } + it { should be_a(Ci::Build) } it('returns with the most recently created build') { should eq(@second) } end describe :retry do before do - @first = FactoryGirl.create :build, commit: commit, created_at: Date.yesterday - @second = FactoryGirl.create :build, commit: commit + @first = FactoryGirl.create :ci_build, commit: commit, created_at: Date.yesterday + @second = FactoryGirl.create :ci_build, commit: commit end it "creates new build" do @@ -62,38 +62,38 @@ describe Commit do context 'always sending notification' do it 'should return commit_pusher_email as only recipient when no additional recipients are given' do - project = FactoryGirl.create :project, + project = FactoryGirl.create :ci_project, email_add_pusher: true, email_recipients: '' - commit = FactoryGirl.create :commit, project: project + commit = FactoryGirl.create :ci_commit, project: project expected = 'commit_pusher_email' commit.stub(:push_data) { { user_email: expected } } commit.project_recipients.should == [expected] end it 'should return commit_pusher_email and additional recipients' do - project = FactoryGirl.create :project, + project = FactoryGirl.create :ci_project, email_add_pusher: true, email_recipients: 'rec1 rec2' - commit = FactoryGirl.create :commit, project: project + commit = FactoryGirl.create :ci_commit, project: project expected = 'commit_pusher_email' commit.stub(:push_data) { { user_email: expected } } commit.project_recipients.should == ['rec1', 'rec2', expected] end it 'should return recipients' do - project = FactoryGirl.create :project, + project = FactoryGirl.create :ci_project, email_add_pusher: false, email_recipients: 'rec1 rec2' - commit = FactoryGirl.create :commit, project: project + commit = FactoryGirl.create :ci_commit, project: project commit.project_recipients.should == ['rec1', 'rec2'] end it 'should return unique recipients only' do - project = FactoryGirl.create :project, + project = FactoryGirl.create :ci_project, email_add_pusher: true, email_recipients: 'rec1 rec1 rec2' - commit = FactoryGirl.create :commit, project: project + commit = FactoryGirl.create :ci_commit, project: project expected = 'rec2' commit.stub(:push_data) { { user_email: expected } } commit.project_recipients.should == ['rec1', 'rec2'] @@ -168,8 +168,8 @@ describe Commit do end context 'for build triggers' do - let(:trigger) { FactoryGirl.create :trigger, project: project } - let(:trigger_request) { FactoryGirl.create :trigger_request, commit: commit, trigger: trigger } + let(:trigger) { FactoryGirl.create :ci_trigger, project: project } + let(:trigger_request) { FactoryGirl.create :ci_trigger_request, commit: commit, trigger: trigger } it 'creates builds' do commit.create_builds(trigger_request).should be_true @@ -215,49 +215,49 @@ describe Commit do end describe "#finished_at" do - let(:project) { FactoryGirl.create :project } - let(:commit) { FactoryGirl.create :commit, project: project } + let(:project) { FactoryGirl.create :ci_project } + let(:commit) { FactoryGirl.create :ci_commit, project: project } it "returns finished_at of latest build" do - build = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 60 - build1 = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 120 + build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60 + build1 = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120 commit.finished_at.to_i.should == build.finished_at.to_i end it "returns nil if there is no finished build" do - build = FactoryGirl.create :not_started_build, commit: commit + build = FactoryGirl.create :ci_not_started_build, commit: commit commit.finished_at.should be_nil end end describe "coverage" do - let(:project) { FactoryGirl.create :project, coverage_regex: "/.*/" } - let(:commit) { FactoryGirl.create :commit, project: project } + let(:project) { FactoryGirl.create :ci_project, coverage_regex: "/.*/" } + let(:commit) { FactoryGirl.create :ci_commit, project: project } it "calculates average when there are two builds with coverage" do - FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit - FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit + FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit commit.coverage.should == "35.00" end it "calculates average when there are two builds with coverage and one with nil" do - FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit - FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit - FactoryGirl.create :build, commit: commit + FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit + FactoryGirl.create :ci_build, commit: commit commit.coverage.should == "35.00" end it "calculates average when there are two builds with coverage and one is retried" do - FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit - FactoryGirl.create :build, name: "rubocop", coverage: 30, commit: commit - FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit + FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, commit: commit + FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit commit.coverage.should == "35.00" end it "calculates average when there is one build without coverage" do - FactoryGirl.create :build, commit: commit + FactoryGirl.create :ci_build, commit: commit commit.coverage.should be_nil end end diff --git a/spec/ci/models/mail_service_spec.rb b/spec/models/ci/mail_service_spec.rb similarity index 74% rename from spec/ci/models/mail_service_spec.rb rename to spec/models/ci/mail_service_spec.rb index d66a6591f8f08a3bb6482572bf488131bb15b4a4..4830d98bdf86315009e68b2ac7323c8c1e5b5747 100644 --- a/spec/ci/models/mail_service_spec.rb +++ b/spec/models/ci/mail_service_spec.rb @@ -14,7 +14,7 @@ require 'spec_helper' -describe MailService do +describe Ci::MailService do describe "Associations" do it { should belong_to :project } end @@ -28,12 +28,12 @@ describe MailService do end describe 'Sends email for' do - let(:mail) { MailService.new } + let(:mail) { Ci::MailService.new } describe 'failed build' do - let(:project) { FactoryGirl.create(:project, email_add_pusher: true) } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :failed, commit: commit) } + let(:project) { FactoryGirl.create(:ci_project, email_add_pusher: true) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) } before do mail.stub( @@ -53,9 +53,9 @@ describe MailService do end describe 'successfull build' do - let(:project) { FactoryGirl.create(:project, email_add_pusher: true, email_only_broken_builds: false) } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } + let(:project) { FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: false) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } before do mail.stub( @@ -76,13 +76,13 @@ describe MailService do describe 'successfull build and project has email_recipients' do let(:project) { - FactoryGirl.create(:project, + FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: false, email_recipients: "jeroen@example.com") } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } before do mail.stub( @@ -104,13 +104,13 @@ describe MailService do describe 'successful build and notify only broken builds' do let(:project) { - FactoryGirl.create(:project, + FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: true, email_recipients: "jeroen@example.com") } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } before do mail.stub( @@ -132,13 +132,13 @@ describe MailService do describe 'successful build and can test service' do let(:project) { - FactoryGirl.create(:project, + FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: false, email_recipients: "jeroen@example.com") } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } before do mail.stub( @@ -154,13 +154,13 @@ describe MailService do describe 'retried build should not receive email' do let(:project) { - FactoryGirl.create(:project, + FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: true, email_recipients: "jeroen@example.com") } - let(:commit) { FactoryGirl.create(:commit, project: project) } - let(:build) { FactoryGirl.create(:build, status: :failed, commit: commit) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } + let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) } before do mail.stub( diff --git a/spec/ci/models/network_spec.rb b/spec/models/ci/network_spec.rb similarity index 100% rename from spec/ci/models/network_spec.rb rename to spec/models/ci/network_spec.rb diff --git a/spec/ci/models/project_services/hip_chat_message_spec.rb b/spec/models/ci/project_services/hip_chat_message_spec.rb similarity index 96% rename from spec/ci/models/project_services/hip_chat_message_spec.rb rename to spec/models/ci/project_services/hip_chat_message_spec.rb index f1ad875ebcfcc9e302c4d9b371bbf98c9e8438e3..3571cb947936dd4aa13b0c11e73e26926df0b33b 100644 --- a/spec/ci/models/project_services/hip_chat_message_spec.rb +++ b/spec/models/ci/project_services/hip_chat_message_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe HipChatMessage do +describe Ci::HipChatMessage do subject { HipChatMessage.new(build) } let(:project) { FactoryGirl.create(:project) } @@ -8,7 +8,7 @@ describe HipChatMessage do context "One build" do let(:commit) { FactoryGirl.create(:commit_with_one_job, project: project) } - let(:build) do + let(:build) do commit.create_builds commit.builds.first end @@ -16,7 +16,7 @@ describe HipChatMessage do context 'when build succeeds' do it 'returns a successful message' do build.update(status: "success") - + expect( subject.status_color ).to eq 'green' expect( subject.notify? ).to be_false expect( subject.to_s ).to match(/Build '[^']+' #\d+/) @@ -39,7 +39,7 @@ describe HipChatMessage do context "Several builds" do let(:commit) { FactoryGirl.create(:commit_with_two_jobs, project: project) } - let(:build) do + let(:build) do commit.builds.first end @@ -63,7 +63,7 @@ describe HipChatMessage do second_build = commit.builds.last first_build.update(status: "success") second_build.update(status: "failed") - + expect( subject.status_color ).to eq 'red' expect( subject.notify? ).to be_true expect( subject.to_s ).to match(/Commit #\d+/) diff --git a/spec/ci/models/project_services/hip_chat_service_spec.rb b/spec/models/ci/project_services/hip_chat_service_spec.rb similarity index 98% rename from spec/ci/models/project_services/hip_chat_service_spec.rb rename to spec/models/ci/project_services/hip_chat_service_spec.rb index 37ce4905af8aeab549d8542e196cb0361c6e5151..71dba8fc3580d80cd42e08187d8407dadaa72709 100644 --- a/spec/ci/models/project_services/hip_chat_service_spec.rb +++ b/spec/models/ci/project_services/hip_chat_service_spec.rb @@ -15,7 +15,7 @@ require 'spec_helper' -describe HipChatService do +describe Ci::HipChatService do describe "Validations" do diff --git a/spec/ci/models/project_services/slack_message_spec.rb b/spec/models/ci/project_services/slack_message_spec.rb similarity index 97% rename from spec/ci/models/project_services/slack_message_spec.rb rename to spec/models/ci/project_services/slack_message_spec.rb index 88e0f3732061ddd7d232e961d07bbe25d9a009a9..4a7284fe4607acbc09faa1ec5c52af42ac9f632b 100644 --- a/spec/ci/models/project_services/slack_message_spec.rb +++ b/spec/models/ci/project_services/slack_message_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe SlackMessage do +describe Ci::SlackMessage do subject { SlackMessage.new(commit) } let(:project) { FactoryGirl.create :project } @@ -8,7 +8,7 @@ describe SlackMessage do context "One build" do let(:commit) { FactoryGirl.create(:commit_with_one_job, project: project) } - let(:build) do + let(:build) do commit.create_builds commit.builds.first end @@ -70,7 +70,7 @@ describe SlackMessage do second_build = commit.builds.last first_build.update(status: "success") second_build.update(status: "failed") - + subject.color.should == color subject.fallback.should include('Commit') subject.fallback.should include("\##{commit.id}") diff --git a/spec/ci/models/project_services/slack_service_spec.rb b/spec/models/ci/project_services/slack_service_spec.rb similarity index 98% rename from spec/ci/models/project_services/slack_service_spec.rb rename to spec/models/ci/project_services/slack_service_spec.rb index e1c1428127459b8c7b8d0e775a49ebe8cd93ccc0..952349a9defe77870f50ee0bcf9649045f5460ef 100644 --- a/spec/ci/models/project_services/slack_service_spec.rb +++ b/spec/models/ci/project_services/slack_service_spec.rb @@ -14,7 +14,7 @@ require 'spec_helper' -describe SlackService do +describe Ci::SlackService do describe "Associations" do it { should belong_to :project } end diff --git a/spec/ci/models/project_spec.rb b/spec/models/ci/project_spec.rb similarity index 100% rename from spec/ci/models/project_spec.rb rename to spec/models/ci/project_spec.rb diff --git a/spec/ci/models/runner_project_spec.rb b/spec/models/ci/runner_project_spec.rb similarity index 91% rename from spec/ci/models/runner_project_spec.rb rename to spec/models/ci/runner_project_spec.rb index cbefb24705aaa92854b4a5f6a938838a9a675321..0218d48413008256d4ac34b9e789134e82be4533 100644 --- a/spec/ci/models/runner_project_spec.rb +++ b/spec/models/ci/runner_project_spec.rb @@ -11,6 +11,6 @@ require 'spec_helper' -describe RunnerProject do +describe Ci::RunnerProject do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/ci/models/runner_spec.rb b/spec/models/ci/runner_spec.rb similarity index 98% rename from spec/ci/models/runner_spec.rb rename to spec/models/ci/runner_spec.rb index 6902c0a94e629b31c4e41b2d59907c50866d3777..8677d86aa02b84e6962636c4711f17b6aa253a3c 100644 --- a/spec/ci/models/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -19,7 +19,7 @@ require 'spec_helper' -describe Runner do +describe Ci::Runner do describe '#display_name' do it 'should return the description if it has a value' do runner = FactoryGirl.build(:runner, description: 'Linux/Ruby-1.9.3-p448') diff --git a/spec/ci/models/service_spec.rb b/spec/models/ci/service_spec.rb similarity index 97% rename from spec/ci/models/service_spec.rb rename to spec/models/ci/service_spec.rb index 22a49e10a6c55f09c58cb476bd7fceed4b13a079..5a90229ec43b0124bdf69fecc5bfb8ef2418fb82 100644 --- a/spec/ci/models/service_spec.rb +++ b/spec/models/ci/service_spec.rb @@ -14,7 +14,7 @@ require 'spec_helper' -describe Service do +describe Ci::Service do describe "Associations" do it { should belong_to :project } diff --git a/spec/ci/models/trigger_spec.rb b/spec/models/ci/trigger_spec.rb similarity index 95% rename from spec/ci/models/trigger_spec.rb rename to spec/models/ci/trigger_spec.rb index bba638e781747ed35726d7601f4067c0a367764e..7c928f9d9dcbdf2967c23406533bacd64446e7f6 100644 --- a/spec/ci/models/trigger_spec.rb +++ b/spec/models/ci/trigger_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Trigger do +describe Ci::Trigger do let(:project) { FactoryGirl.create :project } describe 'before_validation' do diff --git a/spec/ci/models/user_spec.rb b/spec/models/ci/user_spec.rb similarity index 99% rename from spec/ci/models/user_spec.rb rename to spec/models/ci/user_spec.rb index 73a7a7d5fbca8b2d03dbd13e0275281d518327e6..d1b87988b74be069da5f558324da9cd775d76032 100644 --- a/spec/ci/models/user_spec.rb +++ b/spec/models/ci/user_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe User do +describe Ci::User do describe "has_developer_access?" do before do diff --git a/spec/ci/models/variable_spec.rb b/spec/models/ci/variable_spec.rb similarity index 97% rename from spec/ci/models/variable_spec.rb rename to spec/models/ci/variable_spec.rb index 4575115ccfb976784e1c5ea85839c0c8c444187c..447512bf6dfad834a836ca43981e6190e5085d1c 100644 --- a/spec/ci/models/variable_spec.rb +++ b/spec/models/ci/variable_spec.rb @@ -13,7 +13,7 @@ require 'spec_helper' -describe Variable do +describe Ci::Variable do subject { Variable.new } let(:secret_value) { 'secret' } diff --git a/spec/ci/models/web_hook_spec.rb b/spec/models/ci/web_hook_spec.rb similarity index 98% rename from spec/ci/models/web_hook_spec.rb rename to spec/models/ci/web_hook_spec.rb index 0f0f175a7a31c14ed4e1fff6e39eb8719e4e030a..4211576ce5e9245806add8d4b53b620dedfeadbf 100644 --- a/spec/ci/models/web_hook_spec.rb +++ b/spec/models/ci/web_hook_spec.rb @@ -11,7 +11,7 @@ require 'spec_helper' -describe WebHook do +describe Ci::WebHook do describe "Associations" do it { should belong_to :project } end diff --git a/spec/ci/requests/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb similarity index 99% rename from spec/ci/requests/api/builds_spec.rb rename to spec/requests/ci/api/builds_spec.rb index be55e9ff4791157b8eba9cf0ca8e05fd9658540c..7da212da83ab179d902cc4a727a6da8696c48a2d 100644 --- a/spec/ci/requests/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API do +describe Ci::API::API do include ApiHelpers let(:runner) { FactoryGirl.create(:runner, tag_list: ["mysql", "ruby"]) } diff --git a/spec/ci/requests/api/commits_spec.rb b/spec/requests/ci/api/commits_spec.rb similarity index 98% rename from spec/ci/requests/api/commits_spec.rb rename to spec/requests/ci/api/commits_spec.rb index 190df70c1a5c56854b4f8e10bc94addd207d2209..99021dd681d04131e1df106363160587894b3dd7 100644 --- a/spec/ci/requests/api/commits_spec.rb +++ b/spec/requests/ci/api/commits_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API, 'Commits' do +describe Ci::API::API, 'Commits' do include ApiHelpers let(:project) { FactoryGirl.create(:project) } diff --git a/spec/ci/requests/api/forks_spec.rb b/spec/requests/ci/api/forks_spec.rb similarity index 98% rename from spec/ci/requests/api/forks_spec.rb rename to spec/requests/ci/api/forks_spec.rb index af523421c65d86899bba0ef5d208723f8632d3dc..74efc0c30be79ab3a98f17e702d316b890183b3c 100644 --- a/spec/ci/requests/api/forks_spec.rb +++ b/spec/requests/ci/api/forks_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API do +describe Ci::API::API do include ApiHelpers let(:project) { FactoryGirl.create(:project) } diff --git a/spec/ci/requests/api/projects_spec.rb b/spec/requests/ci/api/projects_spec.rb similarity index 99% rename from spec/ci/requests/api/projects_spec.rb rename to spec/requests/ci/api/projects_spec.rb index 014a9efc61772a041cd10770b97a5335b61f9494..65cfc909b485befae134491b90f5c564db081b20 100644 --- a/spec/ci/requests/api/projects_spec.rb +++ b/spec/requests/ci/api/projects_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API do +describe Ci::API::API do include ApiHelpers let(:gitlab_url) { GitlabCi.config.gitlab_server.url } @@ -12,11 +12,11 @@ describe API::API do url: gitlab_url } } - + before { stub_gitlab_calls } - + context "requests for scoped projects" do # NOTE: These ids are tied to the actual projects on demo.gitlab.com describe "GET /projects" do @@ -45,7 +45,7 @@ describe API::API do end end end - + describe "POST /projects/:project_id/webhooks" do let!(:project) { FactoryGirl.create(:project) } diff --git a/spec/ci/requests/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb similarity index 98% rename from spec/ci/requests/api/runners_spec.rb rename to spec/requests/ci/api/runners_spec.rb index 47de3c2a95c09633f903388797b6cc985dd334e8..3faebd40baeeacc4a7b728a5c8445619091a7513 100644 --- a/spec/ci/requests/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API do +describe Ci::API::API do include ApiHelpers include StubGitlabCalls diff --git a/spec/ci/requests/api/triggers_spec.rb b/spec/requests/ci/api/triggers_spec.rb similarity index 99% rename from spec/ci/requests/api/triggers_spec.rb rename to spec/requests/ci/api/triggers_spec.rb index 6e56c4b3b22e5f2e3890ffa22f111e10600349ab..5da40a69991d6069445c13f61713ebfb095feccc 100644 --- a/spec/ci/requests/api/triggers_spec.rb +++ b/spec/requests/ci/api/triggers_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe API::API do +describe Ci::API::API do include ApiHelpers describe 'POST /projects/:project_id/refs/:ref/trigger' do diff --git a/spec/ci/requests/builds_spec.rb b/spec/requests/ci/builds_spec.rb similarity index 100% rename from spec/ci/requests/builds_spec.rb rename to spec/requests/ci/builds_spec.rb diff --git a/spec/ci/requests/commits_spec.rb b/spec/requests/ci/commits_spec.rb similarity index 100% rename from spec/ci/requests/commits_spec.rb rename to spec/requests/ci/commits_spec.rb diff --git a/spec/ci/services/create_commit_service_spec.rb b/spec/services/ci/create_commit_service_spec.rb similarity index 100% rename from spec/ci/services/create_commit_service_spec.rb rename to spec/services/ci/create_commit_service_spec.rb diff --git a/spec/ci/services/create_project_service_spec.rb b/spec/services/ci/create_project_service_spec.rb similarity index 100% rename from spec/ci/services/create_project_service_spec.rb rename to spec/services/ci/create_project_service_spec.rb diff --git a/spec/ci/services/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb similarity index 100% rename from spec/ci/services/create_trigger_request_service_spec.rb rename to spec/services/ci/create_trigger_request_service_spec.rb diff --git a/spec/ci/services/event_service_spec.rb b/spec/services/ci/event_service_spec.rb similarity index 100% rename from spec/ci/services/event_service_spec.rb rename to spec/services/ci/event_service_spec.rb diff --git a/spec/ci/services/image_for_build_service_spec.rb b/spec/services/ci/image_for_build_service_spec.rb similarity index 100% rename from spec/ci/services/image_for_build_service_spec.rb rename to spec/services/ci/image_for_build_service_spec.rb diff --git a/spec/ci/services/register_build_service_spec.rb b/spec/services/ci/register_build_service_spec.rb similarity index 100% rename from spec/ci/services/register_build_service_spec.rb rename to spec/services/ci/register_build_service_spec.rb diff --git a/spec/ci/services/web_hook_service_spec.rb b/spec/services/ci/web_hook_service_spec.rb similarity index 100% rename from spec/ci/services/web_hook_service_spec.rb rename to spec/services/ci/web_hook_service_spec.rb