Commit 17b2b898aa9c6194afdb4e8bb51b2c4ef4f4df43
Exists in
colab
and in
4 other branches
Merge pull request #268 from mezuro/independent_repositories_bug
Fixes repository show page for independent repositories
Showing
4 changed files
with
61 additions
and
2 deletions
Show diff stats
app/views/repositories/show.html.erb
@@ -87,8 +87,8 @@ | @@ -87,8 +87,8 @@ | ||
87 | 87 | ||
88 | <hr/> | 88 | <hr/> |
89 | 89 | ||
90 | -<%= link_to t('back'), project_path(@repository.project_id), class: 'btn btn-default' %> | ||
91 | -<% if project_owner? @repository.project_id %> | 90 | +<%= link_to t('back'), repositories_path, class: 'btn btn-default' %> |
91 | +<% if repository_owner? @repository.id %> | ||
92 | <%= link_to t('repository.show.reprocess'), repository_process_path(@repository.id), class: 'btn btn-info' %> | 92 | <%= link_to t('repository.show.reprocess'), repository_process_path(@repository.id), class: 'btn btn-info' %> |
93 | <%= link_to t('destroy'), repository_path(@repository.id), method: :delete, data: { confirm: t('sure_destroy', model: Repository.model_name.human) }, class: 'btn btn-danger' %> | 93 | <%= link_to t('destroy'), repository_path(@repository.id), method: :delete, data: { confirm: t('sure_destroy', model: Repository.model_name.human) }, class: 'btn btn-danger' %> |
94 | <% end %> | 94 | <% end %> |
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +Feature: Date Select | ||
2 | + In order to view independent repositories | ||
3 | + As a regular user | ||
4 | + I should be able to navigate within it | ||
5 | + | ||
6 | + @kalibro_configuration_restart @kalibro_processor_restart @javascript | ||
7 | + Scenario: With a idenpendent repository | ||
8 | + Given I am a regular user | ||
9 | + And I am signed in | ||
10 | + And I have a sample configuration with ruby native metrics | ||
11 | + And I have a sample repository | ||
12 | + And I own that independent repository | ||
13 | + And I start to process that repository | ||
14 | + And I wait up for a ready processing | ||
15 | + When I visit the repository show page | ||
16 | + Then I should see the sample repository name | ||
17 | + And I should see "State" | ||
18 | + And I should see "Creation Date" | ||
19 | + And I should see "PREPARING time" | ||
20 | + And I should see "COLLECTING time" | ||
21 | + And I should see "BUILDING time" | ||
22 | + And I should see "AGGREGATING time" | ||
23 | + And I should see "CALCULATING time" | ||
24 | + And I should see "INTERPRETING time" | ||
25 | + When I click the "Metric Results" h3 | ||
26 | + And I click the "Modules Tree" h3 | ||
27 | + Then I should see "Metric" | ||
28 | + And I should see "Value" | ||
29 | + And I should see "Weight" | ||
30 | + And I should see "Threshold" | ||
31 | + And I should see "Name" | ||
32 | + And I should see "Granularity" | ||
33 | + And I should see "Grade" | ||
34 | + When I click the Reprocess link | ||
35 | + Then I should see "PREPARING" | ||
36 | + When I click the Back link | ||
37 | + And I wait for "5" seconds | ||
38 | + Then I should be at the Repositories index | ||
0 | \ No newline at end of file | 39 | \ No newline at end of file |
features/step_definitions/kalibro_configuration_steps.rb
@@ -34,6 +34,21 @@ Given(/^I own a configuration named "(.*?)"$/) do |name| | @@ -34,6 +34,21 @@ Given(/^I own a configuration named "(.*?)"$/) do |name| | ||
34 | FactoryGirl.create(:kalibro_configuration_attributes, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id}) | 34 | FactoryGirl.create(:kalibro_configuration_attributes, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id}) |
35 | end | 35 | end |
36 | 36 | ||
37 | +Given(/^I have a sample configuration with ruby native metrics$/) do | ||
38 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, name: 'Sample Ruby Configuration') | ||
39 | + FactoryGirl.create(:kalibro_configuration_attributes, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id}) | ||
40 | + | ||
41 | + reading_group = FactoryGirl.create(:reading_group) | ||
42 | + reading = FactoryGirl.create(:reading, {reading_group_id: reading_group.id}) | ||
43 | + | ||
44 | + metric_configuration = FactoryGirl.create(:metric_configuration, | ||
45 | + {metric: FactoryGirl.build(:pain), | ||
46 | + reading_group_id: reading_group.id, | ||
47 | + kalibro_configuration_id: @kalibro_configuration.id}) | ||
48 | + range = FactoryGirl.build(:kalibro_range, {reading_id: reading.id, beginning: '-INF', :end => 'INF', metric_configuration_id: metric_configuration.id}) | ||
49 | + range.save | ||
50 | +end | ||
51 | + | ||
37 | When(/^I visit the sample configuration edit page$/) do | 52 | When(/^I visit the sample configuration edit page$/) do |
38 | visit edit_kalibro_configuration_path(id: @kalibro_configuration.id) | 53 | visit edit_kalibro_configuration_path(id: @kalibro_configuration.id) |
39 | end | 54 | end |
features/step_definitions/repository_steps.rb
@@ -53,6 +53,7 @@ Given(/^I have a sample of an invalid repository within the sample project$/) do | @@ -53,6 +53,7 @@ Given(/^I have a sample of an invalid repository within the sample project$/) do | ||
53 | end | 53 | end |
54 | 54 | ||
55 | Given(/^I start to process that repository$/) do | 55 | Given(/^I start to process that repository$/) do |
56 | + @repository = @independent_repository if @repository.nil? | ||
56 | @repository.process | 57 | @repository.process |
57 | end | 58 | end |
58 | 59 | ||
@@ -215,3 +216,8 @@ Then(/^the project repository should be there$/) do | @@ -215,3 +216,8 @@ Then(/^the project repository should be there$/) do | ||
215 | expect(page).to have_content(@repository.description) | 216 | expect(page).to have_content(@repository.description) |
216 | end | 217 | end |
217 | 218 | ||
219 | +Then(/^I should be at the Repositories index$/) do | ||
220 | + expect(page.current_path).to end_with(repositories_path) # We use end_with in order to avoid the language route | ||
221 | +end | ||
222 | + | ||
223 | + |