diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-30 07:04:04 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-30 07:06:50 +0300 |
commit | 48ff40a047103bf09d4ac53fdbc984d73bc464cb (patch) | |
tree | a5cf5da6f8be493878d9e0f667888f04446b817a /spec/helpers/blob_helper_spec.rb | |
parent | 6ad514d0663bad80e24586be0919a580cdaab8d2 (diff) |
Improve diff performance by eliminating redundant checks for text blobs
On a merge request with over 1000 changed files, there were redundant
calls to blob_text_viewable?, which incurred about 7% of the time.
Improves #14775
Diffstat (limited to 'spec/helpers/blob_helper_spec.rb')
-rw-r--r-- | spec/helpers/blob_helper_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb index bd0108f9938..b2d6d59b1ee 100644 --- a/spec/helpers/blob_helper_spec.rb +++ b/spec/helpers/blob_helper_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe BlobHelper do + include TreeHelper + let(:blob_name) { 'test.lisp' } let(:no_context_content) { ":type \"assem\"))" } let(:blob_content) { "(make-pathname :defaults name\n#{no_context_content}" } @@ -65,4 +67,20 @@ describe BlobHelper do expect(sanitize_svg(blob).data).to eq(expected) end end + + describe "#edit_blob_link" do + let(:project) { create(:project) } + + before do + allow(self).to receive(:current_user).and_return(double) + end + + it 'verifies blob is text' do + expect(self).not_to receive(:blob_text_viewable?) + + button = edit_blob_link(project, 'refs/heads/master', 'README.md') + + expect(button).to start_with('<button') + end + end end |