summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-07 09:41:51 +0000
committerRémy Coutable <remy@rymai.me>2016-04-07 09:41:51 +0000
commit144912851c388327c31387094ed9054a8e2b322c (patch)
treef24f957d05f891e3e110d2217bc447b9fb8dd3d9 /spec
parent92897d7683bdf17da9708e065465d55ecd808dff (diff)
parent935bf7271d88c8623312004dd6cba791b76503f5 (diff)
downloadgitlab-ce-144912851c388327c31387094ed9054a8e2b322c.tar.gz
Merge branch 'update_main_lang_if_unset' into 'master'
Only update main language if it is not already set Related to gitlab-org/gitlab-ce#14937 (but does not fully fix) This is a temporary fix so performance isn't affected so much. cc @yorickpeterse @ayufan how does this look? See merge request !3556
Diffstat (limited to 'spec')
-rw-r--r--spec/services/git_push_service_spec.rb26
1 files changed, 21 insertions, 5 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index 1047e32960e..b40a5c1c818 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -164,21 +164,37 @@ describe GitPushService, services: true do
end
context "after push" do
- before do
- @service = execute_service(project, user, @oldrev, @newrev, ref)
+ def execute
+ execute_service(project, user, @oldrev, @newrev, ref)
end
context "to master" do
let(:ref) { @ref }
- it { expect(@service.update_main_language).to eq(true) }
- it { expect(project.main_language).to eq("Ruby") }
+ context 'when main_language is nil' do
+ it 'obtains the language from the repository' do
+ expect(project.repository).to receive(:main_language)
+ execute
+ end
+
+ it 'sets the project main language' do
+ execute
+ expect(project.main_language).to eq("Ruby")
+ end
+ end
+
+ context 'when main_language is already set' do
+ it 'does not check the repository' do
+ execute # do an initial run to simulate lang being preset
+ expect(project.repository).not_to receive(:main_language)
+ execute
+ end
+ end
end
context "to other branch" do
let(:ref) { 'refs/heads/feature/branch' }
- it { expect(@service.update_main_language).to eq(nil) }
it { expect(project.main_language).to eq(nil) }
end
end