Commit 4296326521ee1bc82ce0f838a8f23f1449ca9329
Exists in
colab
and in
2 other branches
Merge pull request #346 from mezuro/expose_notify_push_url
Expose notify push url
Showing
8 changed files
with
36 additions
and
2 deletions
Show diff stats
CHANGELOG.rdoc
| ... | ... | @@ -14,6 +14,7 @@ Prezento is the web interface for Mezuro. |
| 14 | 14 | * Add missing translation for CompoundMetric |
| 15 | 15 | * Make Compound Metric Config. metric list not include Hotspot metrics |
| 16 | 16 | * Fix 'Tree Metrics' and 'Hotspot Metrics' PT translations in Configuration show view |
| 17 | +* Show the notify push url for the repository's owner (Gitlab only) | |
| 17 | 18 | |
| 18 | 19 | == v0.11.3 - 01/04/2016 |
| 19 | 20 | ... | ... |
app/views/repositories/show.html.erb
| ... | ... | @@ -37,6 +37,15 @@ |
| 37 | 37 | <%= @kalibro_configuration.name %> |
| 38 | 38 | </p> |
| 39 | 39 | |
| 40 | +<% if repository_owner? @repository.id %> | |
| 41 | + <strong><%= t('repository.show.notify_push_url') %>:</strong> | |
| 42 | + <input id="notify_url" value="<%= repository_notify_push_url(@repository.id) %>" readonly=""> | |
| 43 | + | |
| 44 | + <button id="btn" data-clipboard-target="#notify_url"> | |
| 45 | + <i class="fa fa-copy" alt="Copy to clipboard"></i> | |
| 46 | + </button> | |
| 47 | +<% end %> | |
| 48 | + | |
| 40 | 49 | <p><strong> <%= t('repository.show.date_processing') %>: </strong></p> |
| 41 | 50 | |
| 42 | 51 | <%= form_tag(repository_state_with_date_path(@repository.id), method: "get", remote: true) do %> |
| ... | ... | @@ -74,9 +83,14 @@ |
| 74 | 83 | <div id="metric_results"><%= image_tag 'loader.gif' %> <%= t('repository.show.loading') %></div> |
| 75 | 84 | </div> |
| 76 | 85 | </div> |
| 86 | + | |
| 87 | +<!-- Copy to clipboard --> | |
| 88 | +<%= javascript_include_tag "https://cdn.rawgit.com/zenorocha/clipboard.js/v1.5.10/dist/clipboard.min.js" %> | |
| 89 | + | |
| 77 | 90 | <script type="text/javascript"> |
| 78 | 91 | $(document).ready(function () { |
| 79 | - (new Repository.State(<%= @repository.id %>)).poll_state('') | |
| 92 | + (new Repository.State(<%= @repository.id %>)).poll_state(''); | |
| 93 | + new Clipboard('#btn'); | |
| 80 | 94 | }); |
| 81 | 95 | |
| 82 | 96 | //Loads the accordion | ... | ... |
config/locales/views/repository/en.yml
config/locales/views/repository/pt.yml
features/repository/show/repository_info.feature
| ... | ... | @@ -19,6 +19,7 @@ Feature: Show Repository |
| 19 | 19 | And I should see "Description" |
| 20 | 20 | And I should see "License" |
| 21 | 21 | And I should see the given repository's content |
| 22 | + And I should not see "Notify Push Url for Gitlab" | |
| 22 | 23 | |
| 23 | 24 | @kalibro_configuration_restart @kalibro_processor_restart @javascript |
| 24 | 25 | Scenario: With a ready processing and asking to reprocess |
| ... | ... | @@ -32,6 +33,7 @@ Feature: Show Repository |
| 32 | 33 | And I wait up for a ready processing |
| 33 | 34 | When I visit the repository show page |
| 34 | 35 | Then I should see the sample repository name |
| 36 | + And I should see the correct notify push url | |
| 35 | 37 | And I should see "State" |
| 36 | 38 | And I should see "Creation Date" |
| 37 | 39 | And I should see "PREPARING time" | ... | ... |
features/step_definitions/repository_steps.rb
| ... | ... | @@ -281,3 +281,8 @@ end |
| 281 | 281 | Then(/^I should get a not found error$/) do |
| 282 | 282 | expect(page.driver.status_code).to eq(404) |
| 283 | 283 | end |
| 284 | + | |
| 285 | +Then(/^I should see the correct notify push url$/) do | |
| 286 | + step "I should see \"Notify Push Url for Gitlab\"" | |
| 287 | + expect(page).to have_selector("input[value=\"#{repository_notify_push_url(host: Capybara.current_session.server.host, port: Capybara.current_session.server.port, locale: :en, id: @repository.id)}\"]") | |
| 288 | +end | ... | ... |
features/support/env.rb
| ... | ... | @@ -86,4 +86,4 @@ Cucumber::Rails::Database.javascript_strategy = :truncation |
| 86 | 86 | require 'kalibro_client/kalibro_cucumber_helpers/hooks.rb' |
| 87 | 87 | |
| 88 | 88 | Warden.test_mode! |
| 89 | -World(Warden::Test::Helpers, HeaderUtils, TableUtils) | |
| 89 | +World(Warden::Test::Helpers, HeaderUtils, TableUtils, ActionView::Helpers::UrlHelper) | ... | ... |
spec/controllers/repositories_controller_spec.rb
| ... | ... | @@ -556,5 +556,15 @@ describe RepositoriesController, :type => :controller do |
| 556 | 556 | |
| 557 | 557 | it { is_expected.to respond_with(:not_found) } |
| 558 | 558 | end |
| 559 | + | |
| 560 | + context 'with an invalid request' do | |
| 561 | + before :each do | |
| 562 | + Repository.expects(:find).with(repository.id).returns(repository) | |
| 563 | + Webhooks::GitLab.any_instance.expects(:valid_request?).returns(false) | |
| 564 | + post_push | |
| 565 | + end | |
| 566 | + | |
| 567 | + it { is_expected.to respond_with(:unprocessable_entity) } | |
| 568 | + end | |
| 559 | 569 | end |
| 560 | 570 | end | ... | ... |