diff --git a/app/assets/javascripts/module/tree.js.coffee b/app/assets/javascripts/module/tree.js.coffee
index 49a5421..41f60b9 100644
--- a/app/assets/javascripts/module/tree.js.coffee
+++ b/app/assets/javascripts/module/tree.js.coffee
@@ -1,5 +1,8 @@
class Module.Tree
@load: (loading_html, module_id) ->
+ # FIXME: The messages we send on loading_html are the same already
+ # shown on the Repository's show page
$('div#module_tree').html(loading_html)
$('div#metric_results').html(loading_html)
+ $('div#hotspot_metric_results').html(loading_html)
$.post Routes.module_tree_path(module_id)
diff --git a/app/views/modules/_hotspot_metric_result.html.erb b/app/views/modules/_hotspot_metric_result.html.erb
new file mode 100644
index 0000000..f9368e1
--- /dev/null
+++ b/app/views/modules/_hotspot_metric_result.html.erb
@@ -0,0 +1,4 @@
+
+ | <%= hotspot_metric_result.line_number %> |
+ <%= hotspot_metric_result.message %> |
+
diff --git a/app/views/modules/_hotspot_metric_results.html.erb b/app/views/modules/_hotspot_metric_results.html.erb
new file mode 100644
index 0000000..7c26682
--- /dev/null
+++ b/app/views/modules/_hotspot_metric_results.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ | <%= t('activemodel.attributes.hotspot_metric_result.line') %> |
+ <%= t('activemodel.attributes.hotspot_metric_result.message') %> |
+
+
+
+
+ <% cache("#{@root_module_result.id}_hotspot_results") do %>
+ <%= render partial: 'hotspot_metric_result', collection: @root_module_result.hotspot_metric_results, locals: {module_result: @root_module_result} %>
+ <% end %>
+
+
diff --git a/app/views/modules/load_module_tree.js.erb b/app/views/modules/load_module_tree.js.erb
index 599c810..cc92e31 100644
--- a/app/views/modules/load_module_tree.js.erb
+++ b/app/views/modules/load_module_tree.js.erb
@@ -1,2 +1,3 @@
$('div#module_tree').html('<%= escape_javascript(render partial: "module_tree") %>');
+$('div#hotspot_metric_results').html('<%= escape_javascript(render partial: "hotspot_metric_results") %>')
$('div#metric_results').html('<%= escape_javascript(render partial: "metric_results") %>');
diff --git a/config/locales/views/metric_results/en.yml b/config/locales/views/metric_results/en.yml
index 153567b..d65387f 100644
--- a/config/locales/views/metric_results/en.yml
+++ b/config/locales/views/metric_results/en.yml
@@ -17,3 +17,6 @@ en:
name: "Name"
granularity: "Granularity"
grade: "Grade"
+ hotspot_metric_result:
+ line: "Line"
+ message: "Message"
diff --git a/config/locales/views/metric_results/pt.yml b/config/locales/views/metric_results/pt.yml
index d583d25..cba42f7 100644
--- a/config/locales/views/metric_results/pt.yml
+++ b/config/locales/views/metric_results/pt.yml
@@ -16,4 +16,7 @@ pt:
kalibro_module:
name: "Nome"
granularity: "Granularidade"
- grade: "Nota"
\ No newline at end of file
+ grade: "Nota"
+ hotspot_metric_result:
+ line: "Linha"
+ message: "Mensagem"
diff --git a/features/repository/show/hotspot_metric_results.feature b/features/repository/show/hotspot_metric_results.feature
index fa29848..edb3d55 100644
--- a/features/repository/show/hotspot_metric_results.feature
+++ b/features/repository/show/hotspot_metric_results.feature
@@ -3,6 +3,22 @@ Feature: Repository hotspot metric results
As a regular user
I should see the hotspot metric results list
+ @kalibro_configuration_restart @kalibro_processor_restart @javascript @wip
+ Scenario: Should show the message when the graphic of the given metric has only a single point
+ Given I am a regular user
+ And I am signed in
+ And I have a sample project
+ And I have a sample configuration with hotspot metrics
+ And I have a sample ruby repository within the sample project
+ And I start to process that repository
+ And I wait up for a ready processing
+ And I ask for the last ready processing of the given repository
+ And I ask for the module result of the given processing
+ And I ask for the hotspot metric results of the given module result
+ When I visit the repository show page
+ And I click the "Hotspot Metric Results" h3
+ Then I should see a list of hotspot metric results
+
@kalibro_configuration_restart @kalibro_processor_restart @javascript
Scenario: Should show the error message when the process fails
Given I am a regular user
diff --git a/features/step_definitions/kalibro_configuration_steps.rb b/features/step_definitions/kalibro_configuration_steps.rb
index 29c8e39..89747df 100644
--- a/features/step_definitions/kalibro_configuration_steps.rb
+++ b/features/step_definitions/kalibro_configuration_steps.rb
@@ -13,7 +13,14 @@ end
Given(/^I have a sample configuration$/) do
@kalibro_configuration = FactoryGirl.create(:kalibro_configuration)
FactoryGirl.create(:kalibro_configuration_attributes, user_id: FactoryGirl.create(:another_user).id, kalibro_configuration_id: @kalibro_configuration.id)
+end
+Given(/^I have a sample configuration with hotspot metrics$/) do
+ @kalibro_configuration = FactoryGirl.create(:kalibro_configuration, name: 'Sample Ruby Configuration')
+ FactoryGirl.create(:kalibro_configuration_attributes, {id: nil, user_id: @user.id, kalibro_configuration_id: @kalibro_configuration.id})
+
+ metric_configuration = FactoryGirl.create(:hotspot_metric_configuration,
+ { kalibro_configuration_id: @kalibro_configuration.id} )
end
Given(/^I own a sample configuration$/) do
@@ -94,4 +101,3 @@ Then(/^the private configuration should not be there$/) do
expect(page).to have_no_content(@private_kc.name)
expect(page).to have_no_content(@private_kc.description)
end
-
diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb
index 168f63e..305b607 100644
--- a/features/step_definitions/repository_steps.rb
+++ b/features/step_definitions/repository_steps.rb
@@ -99,6 +99,10 @@ Given(/^I ask for the metric results of the given module result$/) do
@metric_results = @module_result.tree_metric_results
end
+Given(/^I ask for the hotspot metric results of the given module result$/) do
+ @metric_results = @module_result.hotspot_metric_results
+end
+
Given(/^I see a sample metric's name$/) do
expect(page).to have_content(@metric_results.first.metric_configuration.metric.name)
end
@@ -219,5 +223,3 @@ end
Then(/^I should be at the Repositories index$/) do
expect(page.current_path).to end_with(repositories_path) # We use end_with in order to avoid the language route
end
-
-
diff --git a/spec/factories/metric_configurations.rb b/spec/factories/metric_configurations.rb
index 5a987ca..482c154 100644
--- a/spec/factories/metric_configurations.rb
+++ b/spec/factories/metric_configurations.rb
@@ -35,4 +35,8 @@ FactoryGirl.define do
kalibro_configuration_id 1
end
+ factory :hotspot_metric_configuration, class: MetricConfiguration do
+ metric { FactoryGirl.build(:hotspot_metric) }
+ kalibro_configuration_id 1
+ end
end
diff --git a/spec/factories/metrics.rb b/spec/factories/metrics.rb
index 132f8ca..ea5fd7c 100644
--- a/spec/factories/metrics.rb
+++ b/spec/factories/metrics.rb
@@ -52,4 +52,14 @@ FactoryGirl.define do
initialize_with { new(name, code, scope, script) }
end
+
+ factory :hotspot_metric, class: KalibroClient::Entities::Miscellaneous::HotspotMetric do
+ name "Flay"
+ code "flay"
+ description ""
+ metric_collector_name "MetricFu"
+ languages nil
+
+ initialize_with { new(name, code, languages, metric_collector_name) }
+ end
end
--
libgit2 0.21.2