From 74359d6d560bf3291db3069008a6610394d69db0 Mon Sep 17 00:00:00 2001 From: Renan Fichberg Date: Thu, 25 Sep 2014 11:31:39 -0300 Subject: [PATCH] Added acceptance test for the case of a repository processing without ranges --- .gitignore | 1 + features/repository/show/metric_results.feature | 17 +++++++++++++++++ features/step_definitions/mezuro_range_steps.rb | 3 --- features/step_definitions/repository_steps.rb | 12 ++++++++++++ features/support/hooks.rb | 7 +++++++ 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 features/support/hooks.rb diff --git a/.gitignore b/.gitignore index 53ec4b3..b7cac95 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ KalibroService/ analizo_1.16.0_all.deb db_bootstrap.sql install.sh +kalibro_gatekeeper.yml diff --git a/features/repository/show/metric_results.feature b/features/repository/show/metric_results.feature index fea2112..61600b2 100644 --- a/features/repository/show/metric_results.feature +++ b/features/repository/show/metric_results.feature @@ -23,6 +23,23 @@ Feature: Repository metric results When I wait up for the ajax request Then I should see "There is only one point and it will not be printed into a chart." + @kalibro_restart @kalibro_processor_restart @javascript + Scenario: Should show the no range message after a process without range + Given I am a regular user + And I am signed in + And I have a sample project + And I have a sample configuration with native metrics but without ranges + And I have a sample 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 metric results of the given module result + When I visit the repository show page + And I click the "Metric Results" h3 + And I see a sample metric's name + Then I should see "Missing range" + # TODO: Scenario: Should show the graphic of a given metric # It was getting really difficult to test this because of Poltergeist's timeouts # so we gave up on this for now \ No newline at end of file diff --git a/features/step_definitions/mezuro_range_steps.rb b/features/step_definitions/mezuro_range_steps.rb index e54def3..a9b016d 100644 --- a/features/step_definitions/mezuro_range_steps.rb +++ b/features/step_definitions/mezuro_range_steps.rb @@ -37,6 +37,3 @@ Then(/^I should see the sample range$/) do expect(page).to have_content(@mezuro_range.beginning) expect(page).to have_content(@mezuro_range.end) end - - - diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index dc3618b..4d490e6 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -1,3 +1,15 @@ +Given(/^I have a sample configuration with native metrics but without ranges$/) do + reading_group = FactoryGirl.create(:reading_group, id: nil) + reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) + @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, id: nil) + metric_configuration = FactoryGirl.create(:metric_configuration, + {id: nil, + metric: FactoryGirl.build(:loc), + reading_group_id: reading_group.id, + configuration_id: @mezuro_configuration.id, + code: 'loc'}) +end + Given(/^I have a sample configuration with native metrics$/) do reading_group = FactoryGirl.create(:reading_group, id: nil) reading = FactoryGirl.create(:reading, {id: nil, group_id: reading_group.id}) diff --git a/features/support/hooks.rb b/features/support/hooks.rb new file mode 100644 index 0000000..17daaad --- /dev/null +++ b/features/support/hooks.rb @@ -0,0 +1,7 @@ +After do |scenario| +# Do something after each scenario. +# The +scenario+ argument is optional, but +# if you use it, you can inspect status with +# the #failed?, #passed? and #exception methods. +Rails.cache.clear +end \ No newline at end of file -- libgit2 0.21.2