diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2018-10-03 01:44:18 -0500 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2018-10-03 13:18:20 -0500 |
commit | 5a286eb7a3a0c395d35c722ce6a067aca47473f2 (patch) | |
tree | 1eb9364a353cf0dca945e073f7b7f74b246307f2 /spec/serializers | |
parent | c375171bfd4b25d8cf4d7a95e2c65c655c7d647c (diff) | |
download | gitlab-ce-5a286eb7a3a0c395d35c722ce6a067aca47473f2.tar.gz |
Add signature badge to diffs/commit_item
**Notes:**
- Also exposes commit.signature_html in diffs.json
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/commit_entity_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/serializers/commit_entity_spec.rb b/spec/serializers/commit_entity_spec.rb index 35215e06f5f..b8cd24c69a6 100644 --- a/spec/serializers/commit_entity_spec.rb +++ b/spec/serializers/commit_entity_spec.rb @@ -1,10 +1,11 @@ require 'spec_helper' describe CommitEntity do + SIGNATURE_HTML = 'TEST'.freeze + let(:entity) do described_class.new(commit, request: request) end - let(:request) { double('request') } let(:project) { create(:project, :repository) } let(:commit) { project.commit } @@ -12,7 +13,11 @@ describe CommitEntity do subject { entity.as_json } before do + render = double('render') + allow(render).to receive(:call).and_return(SIGNATURE_HTML) + allow(request).to receive(:project).and_return(project) + allow(request).to receive(:render).and_return(render) end context 'when commit author is a user' do @@ -70,6 +75,15 @@ describe CommitEntity do expect(subject.fetch(:description_html)).not_to be_nil expect(subject.fetch(:title_html)).not_to be_nil end + + context 'when commit has signature' do + let(:commit) { project.commit(TestEnv::BRANCH_SHA['signed-commits']) } + + it 'exposes "signature_html"' do + expect(request.render).to receive(:call) + expect(subject.fetch(:signature_html)).to be SIGNATURE_HTML + end + end end context 'when commit_url_params is set' do |