diff options
| author | Douwe Maan <douwe@gitlab.com> | 2015-03-15 15:40:31 +0100 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2015-03-15 15:47:01 +0100 |
| commit | 7929e8bf4d21b55f4b500b012c5201f947635ddb (patch) | |
| tree | 3278cbabbbeed5a63c68b10cc6a2b0faa637a85e /spec | |
| parent | f19eee9959bc89c6d9bbb4bf2e4b19158f5c7fd5 (diff) | |
| download | gitlab-shell-7929e8bf4d21b55f4b500b012c5201f947635ddb.tar.gz | |
Prevent character encoding issues by sending received changes as raw data.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/gitlab_post_receive_spec.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb index fdb9e27..5a9892a 100644 --- a/spec/gitlab_post_receive_spec.rb +++ b/spec/gitlab_post_receive_spec.rb @@ -5,9 +5,11 @@ describe GitlabPostReceive do let(:repository_path) { "/home/git/repositories" } let(:repo_name) { 'dzaporozhets/gitlab-ci' } let(:actor) { 'key-123' } - let(:changes) { 'wow' } + let(:changes) { "123456 789012 refs/heads/tést\n654321 210987 refs/tags/tag" } + let(:wrongly_encoded_changes) { changes.encode("ISO-8859-1").force_encoding("UTF-8") } + let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) } let(:repo_path) { File.join(repository_path, repo_name) + ".git" } - let(:gitlab_post_receive) { GitlabPostReceive.new(repo_path, actor, changes) } + let(:gitlab_post_receive) { GitlabPostReceive.new(repo_path, actor, wrongly_encoded_changes) } let(:message) { "test " * 10 + "message " * 10 } before do @@ -56,7 +58,7 @@ describe GitlabPostReceive do expect(gitlab_post_receive).to receive(:system).with( *[ *%w(env -i redis-cli rpush resque:gitlab:queue:post_receive), - %Q/{"class":"PostReceive","args":["#{repo_path}","#{actor}","#{changes}"]}/, + %Q/{"class":"PostReceive","args":["#{repo_path}","#{actor}",#{base64_changes.inspect}]}/, { err: "/dev/null", out: "/dev/null" } ] ).and_return(true) |
