From bc18aab85cb0258427846e5118c33e779342b26f Mon Sep 17 00:00:00 2001 From: Heitor Reis Date: Mon, 9 Feb 2015 15:11:49 -0200 Subject: [PATCH] Minor fixes and removed @wip from repository date select feature --- app/helpers/kalibro_ranges_helper.rb | 8 ++++---- features/kalibro_range/create.feature | 18 +++++++++--------- features/kalibro_range/deletion.feature | 8 ++++---- features/kalibro_range/edit.feature | 2 +- features/repository/show/date_select.feature | 6 +++--- features/repository/show/metric_results.feature | 4 ++-- features/step_definitions/repository_steps.rb | 30 +++++++----------------------- spec/controllers/base_metric_configurations_controller_spec.rb | 2 +- spec/controllers/compound_metric_configurations_controller_spec.rb | 4 ++-- spec/controllers/kalibro_ranges_controller_spec.rb | 14 +++++++------- spec/controllers/metric_configurations_controller_spec.rb | 8 ++++---- spec/controllers/projects_controller_spec.rb | 2 +- spec/controllers/reading_groups_controller_spec.rb | 4 ++-- spec/controllers/readings_controller_spec.rb | 4 ++-- spec/controllers/repositories_controller_spec.rb | 2 +- 15 files changed, 50 insertions(+), 66 deletions(-) diff --git a/app/helpers/kalibro_ranges_helper.rb b/app/helpers/kalibro_ranges_helper.rb index a90b669..df3b9ce 100644 --- a/app/helpers/kalibro_ranges_helper.rb +++ b/app/helpers/kalibro_ranges_helper.rb @@ -1,5 +1,5 @@ module KalibroRangesHelper - def readings_options(readings) - readings.map { |reading| [reading.label, reading.id] } - end -end \ No newline at end of file + def readings_options(readings) + readings.map { |reading| [reading.label, reading.id] } + end +end diff --git a/features/kalibro_range/create.feature b/features/kalibro_range/create.feature index fd3d4b4..b37ca94 100644 --- a/features/kalibro_range/create.feature +++ b/features/kalibro_range/create.feature @@ -1,10 +1,10 @@ -Feature: Create range - In order to be able to create new ranges +Feature: Create Kalibro Range + In order to be able to create new kalibro ranges As a metric specialist I should be able to fill up a form with its informations and submit it @kalibro_configuration_restart - Scenario: Visiting range creation page when the user own an non-empty reading group + Scenario: Visiting kalibro range creation page when the user owns a non-empty reading group Given I am a regular user And I am signed in And I own a sample configuration @@ -20,7 +20,7 @@ Feature: Create range And I should see "Reading" @kalibro_configuration_restart - Scenario: Visiting range creation page when the user don't own the reading group and this reading group is empty + Scenario: Visiting kalibro range creation page when the user doesn't own the reading group and this reading group is empty Given I am a regular user And I am signed in And I own a sample configuration @@ -36,7 +36,7 @@ Feature: Create range And I should see "The Reading Group of your Metric Configuration belongs to another user and you are not allowed to modify it." @kalibro_configuration_restart - Scenario: Visiting range creation page when the user own an empty reading group (testing link to New Reading) + Scenario: Visiting kalibro range creation page when the user owns an empty reading group (testing link to New Reading) Given I am a regular user And I am signed in And I own a sample configuration @@ -90,7 +90,7 @@ Feature: Create range And I should see "[666.0, 42.0[ is not a valid range" @kalibro_configuration_restart - Scenario: With an invalid beggining (not a number) + Scenario: With an invalid beginning (not a number) Given I am a regular user And I am signed in And I own a sample configuration @@ -143,7 +143,7 @@ Feature: Create range And I should see "Beginning There is already a KalibroRange with beginning 2.0! Please, choose another one." @kalibro_configuration_restart @javascript - Scenario: Should create range with [-INF, INF] threshold + Scenario: Should create a kalibro range with [-INF, INF] threshold Given I am a regular user And I am signed in And I own a sample configuration @@ -161,7 +161,7 @@ Feature: Create range And I should see "INF" @kalibro_configuration_restart @javascript - Scenario: Two valid ranges (one with INF) + Scenario: Two valid kalibro ranges (one with INF) Given I am a regular user And I am signed in And I own a sample configuration @@ -182,4 +182,4 @@ Feature: Create range When I press the Save button Then I should be at metric configuration sample page And I should see "666" - And I should see "INF" \ No newline at end of file + And I should see "INF" diff --git a/features/kalibro_range/deletion.feature b/features/kalibro_range/deletion.feature index 802083b..98d7089 100644 --- a/features/kalibro_range/deletion.feature +++ b/features/kalibro_range/deletion.feature @@ -1,10 +1,10 @@ -Feature: Range Deletion - In order to be able to remove a range +Feature: Kalibro Range Deletion + In order to be able to remove a kalibro range As a regular user The system should have an interface to it @kalibro_configuration_restart - Scenario: Should delete a range that I own + Scenario: Should delete a kalibro range that I own Given I am a regular user And I am signed in And I own a sample configuration @@ -18,7 +18,7 @@ Feature: Range Deletion And I should see "There are no Ranges yet!" @kalibro_configuration_restart - Scenario: Should not see the destroy range link in the range that I not own + Scenario: Should not see the destroy kalibro range link in the kalibro range that I do not own Given I am a regular user And I am signed in And I have a sample configuration diff --git a/features/kalibro_range/edit.feature b/features/kalibro_range/edit.feature index fa1f691..c9a0cea 100644 --- a/features/kalibro_range/edit.feature +++ b/features/kalibro_range/edit.feature @@ -1,5 +1,5 @@ Feature: Kalibro Range Edit - In Order to be able to update my kalibro range info + In order to be able to update my kalibro range info As a regular user I should be able to edit my kalibro ranges diff --git a/features/repository/show/date_select.feature b/features/repository/show/date_select.feature index f69513d..9d44407 100644 --- a/features/repository/show/date_select.feature +++ b/features/repository/show/date_select.feature @@ -3,12 +3,13 @@ Feature: Date Select As a regular user I should be able to select a specific date - @kalibro_configuration_restart @kalibro_processor_restart @javascript @wip + @kalibro_configuration_restart @kalibro_processor_restart @javascript Scenario: With a specific date selected Given I have a sample project And I have a sample configuration with native metrics And I have a sample repository within the sample project And I start to process that repository + And I wait for "60" seconds And I wait up for a ready processing And I start to process that repository And I wait up for the last processing to get ready @@ -18,11 +19,10 @@ Feature: Date Select And I set the select field "month" as "1" And I set the select field "year" as "2013" And I press the Search button - And I wait for "60" seconds And I get the Creation date information as "before" When I set the select field "day" as "1" And I set the select field "month" as "1" And I set the select field "year" as "2020" And I press the Search button And I get the Creation date information as "after" - Then "before" should be less than "after" \ No newline at end of file + Then "before" should be lesser than "after" diff --git a/features/repository/show/metric_results.feature b/features/repository/show/metric_results.feature index a8ccd3e..b029849 100644 --- a/features/repository/show/metric_results.feature +++ b/features/repository/show/metric_results.feature @@ -4,7 +4,7 @@ Feature: Repository metric results I should see the metric results table with its graphics @kalibro_configuration_restart @kalibro_processor_restart @javascript @wip - Scenario: Should show the message when the graphic of the given metric have only a single point + 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 @@ -24,7 +24,7 @@ Feature: Repository metric results Then I should see "There is only one point and it will not be printed into a chart." @kalibro_configuration_restart @kalibro_processor_restart @javascript - Scenario: Should show the no range message after a process without range + Scenario: Should show 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 diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index d4fca6e..d935380 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -41,36 +41,20 @@ Given(/^I start to process that repository$/) do end Given(/^I wait up for a ready processing$/) do - unless Processing.has_ready_processing(@repository.id) - while(true) - if Processing.has_ready_processing(@repository.id) - break - else - sleep(10) - end - end + while !Processing.has_ready_processing(@repository.id) + sleep(10) end end Given(/^I wait up for the last processing to get ready$/) do - while(true) - if Processing.last_processing_of(@repository.id).state == "READY" - break - else - sleep(10) - end + while Processing.last_processing_of(@repository.id).state != "READY" + sleep(10) end end Given(/^I wait up for a error processing$/) do - unless Processing.last_processing_state_of(@repository.id) == "ERROR" - while(true) - if Processing.last_processing_state_of(@repository.id) == "ERROR" - break - else - sleep(10) - end - end + while Processing.last_processing_state_of(@repository.id) != "ERROR" + sleep(10) end end @@ -183,7 +167,7 @@ Then(/^I should see the saved repository's content$/) do expect(page).to have_content(@kalibro_configuration.name) end -Then(/^"(.*?)" should be less than "(.*?)"$/) do |arg1, arg2| +Then(/^"(.*?)" should be lesser than "(.*?)"$/) do |arg1, arg2| v1 = eval "@#{arg1}" v2 = eval "@#{arg2}" diff --git a/spec/controllers/base_metric_configurations_controller_spec.rb b/spec/controllers/base_metric_configurations_controller_spec.rb index ca0c8e9..f298b08 100644 --- a/spec/controllers/base_metric_configurations_controller_spec.rb +++ b/spec/controllers/base_metric_configurations_controller_spec.rb @@ -75,7 +75,7 @@ describe InheritsFromBaseMetricConfigurationsController, :type => :controller do it { is_expected.to respond_with(:success) } end - context "when the current user doesn't owns the kalibro configuration" do + context "when the current user doesn't own the kalibro configuration" do before :each do get :new, kalibro_configuration_id: kalibro_configuration.id end diff --git a/spec/controllers/compound_metric_configurations_controller_spec.rb b/spec/controllers/compound_metric_configurations_controller_spec.rb index 2af46c6..89725b0 100644 --- a/spec/controllers/compound_metric_configurations_controller_spec.rb +++ b/spec/controllers/compound_metric_configurations_controller_spec.rb @@ -20,7 +20,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do it { is_expected.to render_template(:new) } end - context "when the current user doesn't owns the kalibro configuration" do + context "when the current user doesn't own the kalibro configuration" do before :each do get :new, kalibro_configuration_id: kalibro_configuration.id end @@ -88,7 +88,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do describe 'edit' do let(:compound_metric_configuration) { FactoryGirl.build(:compound_metric_configuration_with_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end diff --git a/spec/controllers/kalibro_ranges_controller_spec.rb b/spec/controllers/kalibro_ranges_controller_spec.rb index 0ad9f63..fbe99f2 100644 --- a/spec/controllers/kalibro_ranges_controller_spec.rb +++ b/spec/controllers/kalibro_ranges_controller_spec.rb @@ -23,7 +23,7 @@ describe KalibroRangesController, :type => :controller do it { is_expected.to render_template(:new) } end - context "when the current user doesn't owns the metric configuration" do + context "when the current user doesn't own the metric configuration" do before :each do get :new, kalibro_configuration_id: kalibro_configuration.id, metric_configuration_id: kalibro_range.metric_configuration_id end @@ -41,7 +41,7 @@ describe KalibroRangesController, :type => :controller do sign_in FactoryGirl.create(:user) end - context 'when the current user owns the mezuro range' do + context 'when the current user owns the kalibro range' do before :each do subject.expects(:metric_configuration_owner?).returns true end @@ -113,12 +113,12 @@ describe KalibroRangesController, :type => :controller do let(:kalibro_range) { FactoryGirl.build(:kalibro_range_with_id, metric_configuration_id: metric_configuration.id) } let(:reading) { FactoryGirl.build(:reading_with_id, reading_group_id: metric_configuration.reading_group_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end - context 'when the user owns the mezuro range' do + context 'when the user owns the kalibro range' do before :each do subject.expects(:metric_configuration_owner?).returns true subject.expects(:find_resource).with(KalibroRange, kalibro_range.id).returns(kalibro_range) @@ -130,7 +130,7 @@ describe KalibroRangesController, :type => :controller do it { is_expected.to render_template(:edit) } end - context 'when the user does not own the mezuro range' do + context 'when the user does not own the kalibro range' do let!(:reading_group) { FactoryGirl.build(:reading_group, id: metric_configuration.reading_group_id) } before do @@ -163,7 +163,7 @@ describe KalibroRangesController, :type => :controller do sign_in FactoryGirl.create(:user) end - context 'when user owns the mezuro range' do + context 'when user owns the kalibro range' do before :each do subject.expects(:metric_configuration_owner?).returns true end @@ -194,7 +194,7 @@ describe KalibroRangesController, :type => :controller do end end - context 'when the user does not own the mezuro range' do + context 'when the user does not own the kalibro range' do before :each do post :update, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, id: kalibro_range.id, metric_configuration_id: metric_configuration.id, kalibro_range: kalibro_range_params end diff --git a/spec/controllers/metric_configurations_controller_spec.rb b/spec/controllers/metric_configurations_controller_spec.rb index 3e3683a..87bfb68 100644 --- a/spec/controllers/metric_configurations_controller_spec.rb +++ b/spec/controllers/metric_configurations_controller_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe MetricConfigurationsController, :type => :controller do - let!(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration_with_id) } + let(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration_with_id) } describe 'choose_metric' do let(:metric_collector) { FactoryGirl.build(:metric_collector) } before :each do @@ -40,7 +40,7 @@ describe MetricConfigurationsController, :type => :controller do it { is_expected.to render_template(:new) } end - context "when the current user doesn't owns the kalibro configuration" do + context "when the current user doesn't own the kalibro configuration" do before :each do post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name end @@ -109,7 +109,7 @@ describe MetricConfigurationsController, :type => :controller do describe 'edit' do let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end @@ -196,7 +196,7 @@ describe MetricConfigurationsController, :type => :controller do describe 'destroy' do let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index c189c67..7a6c151 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -88,7 +88,7 @@ describe ProjectsController, :type => :controller do @subject = FactoryGirl.build(:project_with_id) end - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) @ownership = FactoryGirl.build(:project_ownership) diff --git a/spec/controllers/reading_groups_controller_spec.rb b/spec/controllers/reading_groups_controller_spec.rb index 9867618..a62160f 100644 --- a/spec/controllers/reading_groups_controller_spec.rb +++ b/spec/controllers/reading_groups_controller_spec.rb @@ -74,7 +74,7 @@ describe ReadingGroupsController, :type => :controller do @subject = FactoryGirl.build(:reading_group_with_id) end - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) @ownership = FactoryGirl.build(:reading_group_ownership) @@ -140,7 +140,7 @@ describe ReadingGroupsController, :type => :controller do @subject = FactoryGirl.build(:reading_group_with_id) end - context 'with an User logged in' do + context 'with a User logged in' do before do @user = FactoryGirl.create(:user) @ownership = FactoryGirl.build(:reading_group_ownership) diff --git a/spec/controllers/readings_controller_spec.rb b/spec/controllers/readings_controller_spec.rb index b3dabc4..57f494e 100644 --- a/spec/controllers/readings_controller_spec.rb +++ b/spec/controllers/readings_controller_spec.rb @@ -66,7 +66,7 @@ describe ReadingsController, :type => :controller do describe 'edit' do let(:reading) { FactoryGirl.build(:reading_with_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end @@ -160,7 +160,7 @@ describe ReadingsController, :type => :controller do describe 'destroy' do let(:reading) { FactoryGirl.build(:reading_with_id) } - context 'with an User logged in' do + context 'with a User logged in' do before do sign_in FactoryGirl.create(:user) end diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index b0fef75..a315abb 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -4,7 +4,7 @@ describe RepositoriesController, :type => :controller do let(:project) { FactoryGirl.build(:project_with_id) } describe 'new' do - context 'with an User logged in' do + context 'with a User logged in' do before :each do sign_in FactoryGirl.create(:user) end -- libgit2 0.21.2