Commit cd805c02ff32e4223374b8678e89fad793a55e50
1 parent
e8cf8f91
Exists in
colab
and in
4 other branches
Improved the following acceptance tests:
1. Included verification of the list of ranges of a compound metric configuration; 2. Included verification of the list of ranges of a metric configuration. Also fixed show action of compound metric configuration controller. signed-off-by: Renan Fichberg <rfichberg@gmail.com>
Showing
7 changed files
with
34 additions
and
10 deletions
Show diff stats
app/controllers/compound_metric_configurations_controller.rb
@@ -26,6 +26,7 @@ class CompoundMetricConfigurationsController < ApplicationController | @@ -26,6 +26,7 @@ class CompoundMetricConfigurationsController < ApplicationController | ||
26 | def show | 26 | def show |
27 | @compound_metric_configuration = @metric_configuration | 27 | @compound_metric_configuration = @metric_configuration |
28 | @reading_group = ReadingGroup.find(@compound_metric_configuration.reading_group_id) | 28 | @reading_group = ReadingGroup.find(@compound_metric_configuration.reading_group_id) |
29 | + @mezuro_ranges = @compound_metric_configuration.mezuro_ranges | ||
29 | @compound_metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i | 30 | @compound_metric_configuration.configuration_id = params[:mezuro_configuration_id].to_i |
30 | end | 31 | end |
31 | 32 |
app/views/compound_metric_configurations/show.html.erb
@@ -58,7 +58,11 @@ | @@ -58,7 +58,11 @@ | ||
58 | </tr> | 58 | </tr> |
59 | </thead> | 59 | </thead> |
60 | <tbody> | 60 | <tbody> |
61 | - | 61 | + <% if @mezuro_ranges.empty? %> |
62 | + <%= render partial: 'no_ranges' %> | ||
63 | + <% else %> | ||
64 | + <%= render partial: 'metric_configurations/ranges', collection: @mezuro_ranges, as: :mezuro_range %> | ||
65 | + <% end %> | ||
62 | </tbody> | 66 | </tbody> |
63 | </table> | 67 | </table> |
64 | 68 |
app/views/metric_configurations/show.html.erb
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | </tr> | 63 | </tr> |
64 | </thead> | 64 | </thead> |
65 | <tbody> | 65 | <tbody> |
66 | - <% if @mezuro_ranges.size == 0 %> | 66 | + <% if @mezuro_ranges.empty? %> |
67 | <%= render partial: 'no_ranges' %> | 67 | <%= render partial: 'no_ranges' %> |
68 | <% else %> | 68 | <% else %> |
69 | <%= render partial: 'ranges', collection: @mezuro_ranges, as: :mezuro_range %> | 69 | <%= render partial: 'ranges', collection: @mezuro_ranges, as: :mezuro_range %> |
features/compound_metric_configuration/show.feature
@@ -7,7 +7,10 @@ Feature: Show Compound Metric Configuration | @@ -7,7 +7,10 @@ Feature: Show Compound Metric Configuration | ||
7 | Scenario: Checking metric configuration show link | 7 | Scenario: Checking metric configuration show link |
8 | Given I have a sample configuration | 8 | Given I have a sample configuration |
9 | And I have a sample reading group | 9 | And I have a sample reading group |
10 | + And I have a sample reading within the sample reading group labeled "My Reading" | ||
10 | And I have a sample compound metric configuration within the given mezuro configuration | 11 | And I have a sample compound metric configuration within the given mezuro configuration |
12 | + And I have a sample range within the sample compound metric configuration | ||
11 | When I am at the Sample Configuration page | 13 | When I am at the Sample Configuration page |
12 | And I click the Show link | 14 | And I click the Show link |
13 | Then I should be at compound metric configuration sample page | 15 | Then I should be at compound metric configuration sample page |
16 | + And I should see the sample range |
features/metric_configuration/show.feature
@@ -3,11 +3,14 @@ Feature: Show Metric Configuration | @@ -3,11 +3,14 @@ Feature: Show Metric Configuration | ||
3 | As a regular user | 3 | As a regular user |
4 | I should be able to see each of them | 4 | I should be able to see each of them |
5 | 5 | ||
6 | -@kalibro_restart | ||
7 | -Scenario: Checking metric configuration show link | ||
8 | - Given I have a sample configuration | ||
9 | - And I have a sample reading group | ||
10 | - And I have a sample metric configuration within the given mezuro configuration | ||
11 | - When I am at the Sample Configuration page | ||
12 | - And I click the Show link | ||
13 | - Then I should be at metric configuration sample page | ||
14 | \ No newline at end of file | 6 | \ No newline at end of file |
7 | + @kalibro_restart | ||
8 | + Scenario: Checking metric configuration show link | ||
9 | + Given I have a sample configuration | ||
10 | + And I have a sample reading group | ||
11 | + And I have a sample reading within the sample reading group labeled "My Reading" | ||
12 | + And I have a sample metric configuration within the given mezuro configuration | ||
13 | + And I have a sample range within the sample metric configuration | ||
14 | + When I am at the Sample Configuration page | ||
15 | + And I click the Show link | ||
16 | + Then I should be at metric configuration sample page | ||
17 | + And I should see the sample range |
features/step_definitions/mezuro_range_steps.rb
@@ -16,6 +16,11 @@ Given(/^I have a sample range within the sample metric configuration$/) do | @@ -16,6 +16,11 @@ Given(/^I have a sample range within the sample metric configuration$/) do | ||
16 | reading_id: @reading.id, id: nil}) | 16 | reading_id: @reading.id, id: nil}) |
17 | end | 17 | end |
18 | 18 | ||
19 | +Given(/^I have a sample range within the sample compound metric configuration$/) do | ||
20 | + @mezuro_range = FactoryGirl.create(:mezuro_range, {metric_configuration_id: @compound_metric_configuration.id, | ||
21 | + reading_id: @reading.id, id: nil}) | ||
22 | +end | ||
23 | + | ||
19 | Then(/^I should be at the New Range page$/) do | 24 | Then(/^I should be at the New Range page$/) do |
20 | page.should have_content("New Range") | 25 | page.should have_content("New Range") |
21 | page.should have_content("Beginning") | 26 | page.should have_content("Beginning") |
@@ -27,3 +32,9 @@ When(/^I am at the New Range page$/) do | @@ -27,3 +32,9 @@ When(/^I am at the New Range page$/) do | ||
27 | visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id) | 32 | visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id) |
28 | end | 33 | end |
29 | 34 | ||
35 | +Then(/^I should see the sample range$/) do | ||
36 | + page.should have_content(@mezuro_range.label) | ||
37 | + page.should have_content(@mezuro_range.beginning) | ||
38 | + page.should have_content(@mezuro_range.end) | ||
39 | +end | ||
40 | + |
spec/controllers/compound_metric_configurations_controller_spec.rb
@@ -70,10 +70,12 @@ describe CompoundMetricConfigurationsController do | @@ -70,10 +70,12 @@ describe CompoundMetricConfigurationsController do | ||
70 | describe 'show' do | 70 | describe 'show' do |
71 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } | 71 | let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration) } |
72 | let(:reading_group) { FactoryGirl.build(:reading_group) } | 72 | let(:reading_group) { FactoryGirl.build(:reading_group) } |
73 | + let(:mezuro_range) { FactoryGirl.build(:mezuro_range) } | ||
73 | 74 | ||
74 | before :each do | 75 | before :each do |
75 | ReadingGroup.expects(:find).with(compound_metric_configuration.reading_group_id).returns(reading_group) | 76 | ReadingGroup.expects(:find).with(compound_metric_configuration.reading_group_id).returns(reading_group) |
76 | MetricConfiguration.expects(:find).with(compound_metric_configuration.id).returns(compound_metric_configuration) | 77 | MetricConfiguration.expects(:find).with(compound_metric_configuration.id).returns(compound_metric_configuration) |
78 | + MezuroRange.expects(:ranges_of).with(compound_metric_configuration.id).returns([mezuro_range]) | ||
77 | 79 | ||
78 | get :show, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s, id: compound_metric_configuration.id | 80 | get :show, mezuro_configuration_id: compound_metric_configuration.configuration_id.to_s, id: compound_metric_configuration.id |
79 | end | 81 | end |