diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-12 07:05:16 -0700 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-12 07:05:16 -0700 |
| commit | edb3368c93c6ff64840ef5cd12f2af30b18b5b52 (patch) | |
| tree | d043ae45efae3440d6f665122800b0edb30eadf3 | |
| parent | 4f9bc937b3b74cc16c899d51402004eb70a5149e (diff) | |
| parent | 0a05ab9126aa1edadea069e9e7dbe272da4b9618 (diff) | |
| download | gitlab-ce-edb3368c93c6ff64840ef5cd12f2af30b18b5b52.tar.gz | |
Merge pull request #5048 from Nullreff/image-diff
Fix bug with rendering changing images in commits
| -rw-r--r-- | app/views/projects/commits/_image.html.haml | 4 | ||||
| -rw-r--r-- | features/project/commits/commits.feature | 4 | ||||
| -rw-r--r-- | features/steps/project/project_browse_commits.rb | 10 |
3 files changed, 16 insertions, 2 deletions
diff --git a/app/views/projects/commits/_image.html.haml b/app/views/projects/commits/_image.html.haml index db02fa333b9..73f87289d3d 100644 --- a/app/views/projects/commits/_image.html.haml +++ b/app/views/projects/commits/_image.html.haml @@ -9,7 +9,7 @@ %div.two-up.view %span.wrap .frame.deleted - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.old_path))} + %a{href: project_blob_path(@project, tree_join(@commit.parent_id, diff.old_path))} %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} %p.image-info.hide %span.meta-filesize= "#{number_to_human_size old_file.size}" @@ -21,7 +21,7 @@ %span.meta-height %span.wrap .frame.added - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.new_path))} + %a{href: project_blob_path(@project, tree_join(@commit.id, diff.new_path))} %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} %p.image-info.hide %span.meta-filesize= "#{number_to_human_size file.size}" diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature index d962471ebdb..fe470f5ac99 100644 --- a/features/project/commits/commits.feature +++ b/features/project/commits/commits.feature @@ -35,3 +35,7 @@ Feature: Project Browse commits Scenario: I browse huge commit Given I visit huge commit page Then I see huge commit message + + Scenario: I browse a commit with an image + Given I visit a commit with an image that changed + Then The diff links to both the previous and current image diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index 4b122b853e6..650bc3a16f7 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -78,4 +78,14 @@ class ProjectBrowseCommits < Spinach::FeatureSteps page.should have_content "Warning! This is a large diff" page.should_not have_content "If you still want to see the diff" end + + Given 'I visit a commit with an image that changed' do + visit project_commit_path(@project, 'cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b') + end + + Then 'The diff links to both the previous and current image' do + links = page.all('.two-up span div a') + links[0]['href'].should =~ %r{blob/bc3735004cb45cec5e0e4fa92710897a910a5957} + links[1]['href'].should =~ %r{blob/cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b} + end end |
