diff --git a/app/controllers/metric_configurations_controller.rb b/app/controllers/metric_configurations_controller.rb
index af6ec21..bb9d620 100644
--- a/app/controllers/metric_configurations_controller.rb
+++ b/app/controllers/metric_configurations_controller.rb
@@ -2,8 +2,8 @@ include OwnershipAuthentication
include MetricConfigurationsConcern
class MetricConfigurationsController < ApplicationController
- before_action :authenticate_user!, except: [:index]
- before_action :set_metric_configuration, only: [:edit, :update, :destroy]
+ before_action :authenticate_user!, except: [:show, :index]
+ before_action :set_metric_configuration, only: [:show, :edit, :update, :destroy]
before_action :metric_configuration_owner?, only: [:edit, :update, :destroy]
before_action :mezuro_configuration_owner?, only: [:new, :create, :choose_metric]
@@ -29,6 +29,10 @@ class MetricConfigurationsController < ApplicationController
end
end
+ def show
+ @reading_group = ReadingGroup.find(@metric_configuration.reading_group_id)
+ end
+
def edit
#FIXME: set the configuration id just once!
@mezuro_configuration_id = params[:mezuro_configuration_id]
diff --git a/app/views/metric_configurations/show.html.erb b/app/views/metric_configurations/show.html.erb
new file mode 100644
index 0000000..51b5822
--- /dev/null
+++ b/app/views/metric_configurations/show.html.erb
@@ -0,0 +1,55 @@
+
+
+
+ Base Tool Name:
+ <%= @metric_configuration.base_tool_name %>
+
+
+
+ Code:
+ <%= @metric_configuration.code %>
+
+
+
+ Weight:
+ <%= @metric_configuration.weight %>
+
+
+
+ Language:
+ <%= @metric_configuration.metric.language %>
+
+
+
+ Scope:
+ <%= @metric_configuration.metric.scope %>
+
+
+
+ Aggregation Form:
+ <%= @metric_configuration.aggregation_form %>
+
+
+
+ Reading Group Name:
+ <%= @reading_group.name %>
+
+
+
+ Description:
+ <% if @metric_configuration.metric.description.nil? %>
+ <%= "There is no description available." %>
+ <% else %>
+ <%= @metric_configuration.metric.description %>
+ <% end %>
+
+
+
+
+ Ranges
+
+
+
+
diff --git a/app/views/mezuro_configurations/_metric_configurations.html.erb b/app/views/mezuro_configurations/_metric_configurations.html.erb
index cc6255a..22ee4bf 100644
--- a/app/views/mezuro_configurations/_metric_configurations.html.erb
+++ b/app/views/mezuro_configurations/_metric_configurations.html.erb
@@ -2,6 +2,10 @@
<%= metric_configuration.metric.name %> |
<%= metric_configuration.code %> |
<%= metric_configuration.weight %> |
+
+ <%= link_to 'Show', mezuro_configuration_metric_configuration_path(@mezuro_configuration.id, metric_configuration.id),
+ class: 'btn btn-info' %>
+ |
<% if mezuro_configuration_owner? @mezuro_configuration.id %>
<%= link_to_edit_form(metric_configuration, @mezuro_configuration.id) %>
diff --git a/features/metric_configuration/show.feature b/features/metric_configuration/show.feature
new file mode 100644
index 0000000..3a37966
--- /dev/null
+++ b/features/metric_configuration/show.feature
@@ -0,0 +1,13 @@
+Feature: Show Metric Configuration
+ In order to know all the metric configurations of the given configuration and its contents
+ As a regular user
+ I should be able to see each of them
+
+@kalibro_restart
+Scenario: Checking metric configuration show link
+ Given I have a sample configuration
+ And I have a sample reading group
+ And I have a sample metric configuration within the given mezuro configuration
+ When I am at the Sample Configuration page
+ And I click the Show link
+ Then I should be at metric configuration sample page
\ No newline at end of file
diff --git a/features/mezuro_configuration/show.feature b/features/mezuro_configuration/show.feature
index efbe180..8225f56 100644
--- a/features/mezuro_configuration/show.feature
+++ b/features/mezuro_configuration/show.feature
@@ -1,5 +1,5 @@
Feature: Show Configuration
- In order to know all the repositories of the given configuration and its contents
+ In order to know all the contents of a given configuration
As a regular user
I should be able to see each of them
diff --git a/features/step_definitions/metric_configuration_steps.rb b/features/step_definitions/metric_configuration_steps.rb
index acc0d5a..6eaf438 100644
--- a/features/step_definitions/metric_configuration_steps.rb
+++ b/features/step_definitions/metric_configuration_steps.rb
@@ -16,4 +16,14 @@ Then(/^I should see the sample metric configuration content$/) do
page.should have_content(@metric_configuration.metric.name)
page.should have_content(@metric_configuration.code)
page.should have_content(@metric_configuration.weight)
+end
+
+When(/^I visit the sample metric configuration page$/) do
+ visit edit_mezuro_configuration_path(@mezuro_configuration.id)
+end
+
+
+Then(/^I should be at metric configuration sample page$/) do
+ page.should have_content(@metric_configuration.metric.name)
+ page.should have_content("Ranges")
end
\ No newline at end of file
diff --git a/spec/controllers/metric_configurations_controller_spec.rb b/spec/controllers/metric_configurations_controller_spec.rb
index a5ca2c9..73f94cb 100644
--- a/spec/controllers/metric_configurations_controller_spec.rb
+++ b/spec/controllers/metric_configurations_controller_spec.rb
@@ -84,6 +84,17 @@ describe MetricConfigurationsController do
end
end
end
+
+ describe 'show' do
+ let(:metric_configuration) { FactoryGirl.build(:metric_configuration) }
+ let(:reading_group) { FactoryGirl.build(:reading_group) }
+ before :each do
+ ReadingGroup.expects(:find).with(metric_configuration.reading_group_id).returns(reading_group)
+ get :show, mezuro_configuration_id: metric_configuration.configuration_id.to_s, id: metric_configuration.id
+ end
+
+ it { should render_template(:show) }
+ end
describe 'edit' do
let(:metric_configuration) { FactoryGirl.build(:metric_configuration) }
--
libgit2 0.21.2 |