adds test for git push service for updating the language of the project
This commit is contained in:
parent
4e8a534397
commit
4929592458
|
@ -51,16 +51,18 @@ class GitPushService < BaseService
|
|||
update_merge_requests
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def update_main_language
|
||||
current_language = @project.repository.main_language
|
||||
|
||||
unless current_language == @project.main_language
|
||||
@project.update_attributes(main_language: current_language)
|
||||
return @project.update_attributes(main_language: current_language)
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def update_merge_requests
|
||||
@project.update_merge_requests(params[:oldrev], params[:newrev], params[:ref], current_user)
|
||||
|
||||
|
|
|
@ -155,6 +155,23 @@ describe GitPushService, services: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe "Updates main language" do
|
||||
|
||||
context "before push" do
|
||||
it { expect(project.main_language).to eq(nil) }
|
||||
end
|
||||
|
||||
context "after push" do
|
||||
before do
|
||||
@service = execute_service(project, user, @oldrev, @newrev, @ref)
|
||||
end
|
||||
|
||||
it { expect(@service.update_main_language).to eq(true) }
|
||||
it { expect(project.main_language).to eq("Ruby") }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "Web Hooks" do
|
||||
context "execute web hooks" do
|
||||
it "when pushing a branch for the first time" do
|
||||
|
|
Loading…
Reference in New Issue