Commit dc29b237330a0a4277ebcb339a7b65296404267c

Authored by Dmitriy Zaporozhets
2 parents 0da6394c 5907207e

Merge pull request #5725 from Popl7/http_repo_link_on_public_acces

Correct url to pull puplic repos anonymously on project page
app/views/shared/_clone_panel.html.haml
1 1 .git-clone-holder
2   - %button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH
3   - %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= gitlab_config.protocol.upcase
4   - = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5", readonly: true
  2 + %button{class: "btn #{ current_user ? 'active' : '' }", :"data-clone" => @project.ssh_url_to_repo} SSH
  3 + %button{class: "btn #{ current_user ? '' : 'active' }", :"data-clone" => @project.http_url_to_repo}= gitlab_config.protocol.upcase
  4 + = text_field_tag :project_clone, (current_user ? @project.url_to_repo : @project.http_url_to_repo), class: "one_click_select span5", readonly: true
... ...
features/public/public_projects.feature
... ... @@ -38,3 +38,14 @@ Feature: Public Projects Feature
38 38 Given I sign in as a user
39 39 When I visit project "Internal" page
40 40 Then I should see project "Internal" home page
  41 +
  42 + Scenario: I visit public project page
  43 + When I visit project "Community" page
  44 + Then I should see project "Community" home page
  45 + And I should see a http link to the repository
  46 +
  47 + Scenario: I visit public area as user
  48 + Given I sign in as a user
  49 + When I visit project "Community" page
  50 + Then I should see project "Community" home page
  51 + And I should see a ssh link to the repository
... ...
features/steps/public/projects_feature.rb
... ... @@ -83,5 +83,15 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
83 83 page.should have_content 'Internal'
84 84 end
85 85 end
  86 +
  87 + Then 'I should see a http link to the repository' do
  88 + project = Project.find_by_name 'Community'
  89 + page.should have_field('project_clone', with: project.http_url_to_repo)
  90 + end
  91 +
  92 + Then 'I should see a ssh link to the repository' do
  93 + project = Project.find_by_name 'Community'
  94 + page.should have_field('project_clone', with: project.url_to_repo)
  95 + end
86 96 end
87 97  
... ...