Commit 686bd88dd082982b3eb4a8e2401091a52db2d401

Authored by Guilherme Rojas V. de Lima
Committed by Rafael Manzo
1 parent 5d6fbeea

Included new informations in repository show

pending: refactor acceptance test to verify the process_period and configuration informations.

Signed-off By: Diego Araújo <diegoamc90@gmail.com>
app/helpers/repository_helper.rb
@@ -6,4 +6,8 @@ module RepositoryHelper @@ -6,4 +6,8 @@ module RepositoryHelper
6 def license_options 6 def license_options
7 YAML.load_file("config/licenses.yml").split("; ") 7 YAML.load_file("config/licenses.yml").split("; ")
8 end 8 end
  9 +
  10 + def periodicity_option(periodicity)
  11 + periodicity_options.select {|option| option.last == periodicity}.first.first
  12 + end
9 end 13 end
10 \ No newline at end of file 14 \ No newline at end of file
app/views/repositories/show.html.erb
@@ -3,11 +3,31 @@ @@ -3,11 +3,31 @@
3 </div> 3 </div>
4 4
5 <p> 5 <p>
  6 + <strong>Description:</strong>
  7 + <%= @repository.description %>
  8 +</p>
  9 +
  10 +<p>
  11 + <strong>License:</strong>
  12 + <%= @repository.license %>
  13 +</p>
  14 +
  15 +<p>
  16 + <strong>Type:</strong>
  17 + <%= @repository.type %>
  18 +</p>
  19 +
  20 +<p>
6 <strong>Address:</strong> 21 <strong>Address:</strong>
7 <%= @repository.address %> 22 <%= @repository.address %>
8 </p> 23 </p>
9 24
10 <p> 25 <p>
  26 + <strong>Periodicity:</strong>
  27 + <%= periodicity_option(@repository.process_period) %>
  28 +</p>
  29 +
  30 +<p>
11 <strong>Configuration:</strong> 31 <strong>Configuration:</strong>
12 <%= @configuration.name %> 32 <%= @configuration.name %>
13 </p> 33 </p>
features/repository/edit.feature
@@ -16,12 +16,16 @@ Feature: Repository Edit @@ -16,12 +16,16 @@ Feature: Repository Edit
16 Then the field "Name" should be filled with "QtCalculator" 16 Then the field "Name" should be filled with "QtCalculator"
17 And the field "Type" should be filled with "SUBVERSION" 17 And the field "Type" should be filled with "SUBVERSION"
18 And the field "Address" should be filled with "svn://svn.code.sf.net/p/qt-calculator/code/trunk" 18 And the field "Address" should be filled with "svn://svn.code.sf.net/p/qt-calculator/code/trunk"
  19 + And I set the select field "Process Period" as "Weekly"
  20 + And I set the select field "License" as "EU DataGrid Software License (EUDatagrid)"
19 When I fill the Name field with "MedSquare" 21 When I fill the Name field with "MedSquare"
20 And I set the select field "Type" as "GIT" 22 And I set the select field "Type" as "GIT"
21 And I fill the Address field with "git://git.code.sf.net/p/medsquare/git" 23 And I fill the Address field with "git://git.code.sf.net/p/medsquare/git"
22 And I press the Save button 24 And I press the Save button
23 Then I should see "MedSquare" 25 Then I should see "MedSquare"
24 And I should see "git://git.code.sf.net/p/medsquare/git" 26 And I should see "git://git.code.sf.net/p/medsquare/git"
  27 + And I should see "Weekly"
  28 + And I should see "EU DataGrid Software License (EUDatagrid)"
25 29
26 @kalibro_restart 30 @kalibro_restart
27 Scenario: editing a repository with blank fields 31 Scenario: editing a repository with blank fields
features/repository/show.feature
@@ -3,6 +3,22 @@ Feature: Show Repository @@ -3,6 +3,22 @@ Feature: Show Repository
3 As a regular user 3 As a regular user
4 I should see it's informations 4 I should see it's informations
5 5
  6 + @kalibro_restart @javascript @wip
  7 + Scenario: Testing the repository values
  8 + Given I have a sample project
  9 + And I have a sample configuration with native metrics
  10 + And I have a sample repository within the sample project
  11 + And I start to process that repository
  12 + And I wait up for a ready processing
  13 + When I visit the repository show page
  14 + Then I should see "Address"
  15 + And I should see "Configuration"
  16 + And I should see "Periodicity"
  17 + And I should see "Type"
  18 + And I should see "Description"
  19 + And I should see "License"
  20 + And I should see the given repository's content
  21 +
6 @kalibro_restart @javascript 22 @kalibro_restart @javascript
7 Scenario: With a ready processing 23 Scenario: With a ready processing
8 Given I am a regular user 24 Given I am a regular user
@@ -14,19 +30,20 @@ Feature: Show Repository @@ -14,19 +30,20 @@ Feature: Show Repository
14 And I wait up for a ready processing 30 And I wait up for a ready processing
15 When I visit the repository show page 31 When I visit the repository show page
16 Then I should see the sample repository name 32 Then I should see the sample repository name
17 - And I should see "Address"  
18 - And I should see "Configuration"  
19 And I should see "State" 33 And I should see "State"
20 And I should see "Creation date" 34 And I should see "Creation date"
21 And I should see "LOADING time" 35 And I should see "LOADING time"
22 And I should see "COLLECTING time" 36 And I should see "COLLECTING time"
23 And I should see "ANALYZING time" 37 And I should see "ANALYZING time"
24 - #TODO: test if the module results tree is getting rendered  
25 When I click the "Metric Results" h3 38 When I click the "Metric Results" h3
26 Then I should see "Metric" 39 Then I should see "Metric"
27 And I should see "Value" 40 And I should see "Value"
28 And I should see "Weight" 41 And I should see "Weight"
29 And I should see "Threshold" 42 And I should see "Threshold"
  43 + When I click the "Modules Tree" h3
  44 + Then I should see "Name"
  45 + And I should see "Granularity"
  46 + And I should see "Grade"
30 47
31 @kalibro_restart @javascript 48 @kalibro_restart @javascript
32 Scenario: Just after start to process 49 Scenario: Just after start to process
features/step_definitions/repository_steps.rb
@@ -97,6 +97,13 @@ Then(/^I should see a sample child&#39;s name$/) do @@ -97,6 +97,13 @@ Then(/^I should see a sample child&#39;s name$/) do
97 page.should have_content(@module_result.children.first.module.name) 97 page.should have_content(@module_result.children.first.module.name)
98 end 98 end
99 99
  100 +Then(/^I should see the given repository's content$/) do
  101 + page.should have_content(@repository.type)
  102 + page.should have_content(@repository.description)
  103 + page.should have_content(@repository.name)
  104 + page.should have_content(@repository.license)
  105 +end
  106 +
100 Then(/^I should see a loaded graphic for the sample metric$/) do 107 Then(/^I should see a loaded graphic for the sample metric$/) do
101 while (page.driver.network_traffic.last.response_parts.empty?) do 108 while (page.driver.network_traffic.last.response_parts.empty?) do
102 sleep(10) 109 sleep(10)
spec/helpers/repository_helper_spec.rb
@@ -13,4 +13,10 @@ describe RepositoryHelper do @@ -13,4 +13,10 @@ describe RepositoryHelper do
13 helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ") 13 helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ")
14 end 14 end
15 end 15 end
  16 +
  17 + describe 'periodicity_option' do
  18 + it 'should return the periodicity option associated to the given number' do
  19 + helper.periodicity_option(1).should eq "1 day"
  20 + end
  21 + end
16 end 22 end
17 \ No newline at end of file 23 \ No newline at end of file