summaryrefslogtreecommitdiff
path: root/spec/services/git_push_service_spec.rb
diff options
context:
space:
mode:
authorMatt Oakes <matt@ribot.co.uk>2016-03-14 23:33:00 +0000
committerMatt Oakes <matt@ribot.co.uk>2016-04-29 12:45:15 +0100
commit28dcdb27795de79337df7aeff1107114cdffc2f9 (patch)
treef32671e2eda91e99eba67da189c2f52370da14a1 /spec/services/git_push_service_spec.rb
parent10f84f99cb663faae37139495f547bb68bd8aced (diff)
downloadgitlab-ce-28dcdb27795de79337df7aeff1107114cdffc2f9.tar.gz
Support supressing text file diffs on the default branch with .gitattributes
This is a combination of 3 commits. - Update the bare repositories info/attributes if the default branch is updated - Check the diff attributes of a file before showing a diff - Update CHANGELOG
Diffstat (limited to 'spec/services/git_push_service_spec.rb')
-rw-r--r--spec/services/git_push_service_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index b40a5c1c818..eeab540c2fd 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -201,6 +201,36 @@ describe GitPushService, services: true do
end
+ describe "Updates git attributes" do
+ context "for default branch" do
+ it "calls the copy attributes method for the first push to the default branch" do
+ expect(project.repository).to receive(:copy_gitattributes).with('master')
+
+ execute_service(project, user, @blankrev, 'newrev', 'refs/heads/master')
+ end
+
+ it "calls the copy attributes method for changes to the default branch" do
+ expect(project.repository).to receive(:copy_gitattributes).with('refs/heads/master')
+
+ execute_service(project, user, 'oldrev', 'newrev', 'refs/heads/master')
+ end
+ end
+
+ context "for non-default branch" do
+ before do
+ # Make sure the "default" branch is different
+ allow(project).to receive(:default_branch).and_return('not-master')
+ end
+
+ it "does not call copy attributes method" do
+ expect(project.repository).not_to receive(:copy_gitattributes)
+
+ execute_service(project, user, @oldrev, @newrev, @ref)
+ end
+ end
+ end
+
+
describe "Webhooks" do
context "execute webhooks" do
it "when pushing a branch for the first time" do