diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-10 21:23:19 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-04-10 21:23:19 +0000 |
commit | fb8a12c8fea422a9054fcbdb2e6b22770e9dfab3 (patch) | |
tree | dd8b86df7d03857238a994683a6b7f5014208570 /spec/models/blob_spec.rb | |
parent | 520ed0781cc86f3c158b3ebcfb2457dba3b41a6e (diff) | |
download | gitlab-ce-fb8a12c8fea422a9054fcbdb2e6b22770e9dfab3.tar.gz |
Don't show 'Copy content' button on text files that are not rendered as text
Diffstat (limited to 'spec/models/blob_spec.rb')
-rw-r--r-- | spec/models/blob_spec.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index 0f29766db41..e5dd57fc4bb 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -55,13 +55,13 @@ describe Blob do describe '#pdf?' do it 'is falsey when file extension is not .pdf' do - git_blob = double(name: 'git_blob.txt') + git_blob = Gitlab::Git::Blob.new(name: 'git_blob.txt') expect(described_class.decorate(git_blob)).not_to be_pdf end it 'is truthy when file extension is .pdf' do - git_blob = double(name: 'git_blob.pdf') + git_blob = Gitlab::Git::Blob.new(name: 'git_blob.pdf') expect(described_class.decorate(git_blob)).to be_pdf end @@ -140,7 +140,7 @@ describe Blob do stl?: false ) - described_class.decorate(double).tap do |blob| + described_class.decorate(Gitlab::Git::Blob.new({})).tap do |blob| allow(blob).to receive_messages(overrides) end end @@ -158,7 +158,7 @@ describe Blob do it 'handles SVGs' do blob = stubbed_blob(text?: true, svg?: true) - expect(blob.to_partial_path(project)).to eq 'image' + expect(blob.to_partial_path(project)).to eq 'svg' end it 'handles images' do @@ -167,7 +167,7 @@ describe Blob do end it 'handles text' do - blob = stubbed_blob(text?: true) + blob = stubbed_blob(text?: true, name: 'test.txt') expect(blob.to_partial_path(project)).to eq 'text' end |