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 6 def license_options
7 7 YAML.load_file("config/licenses.yml").split("; ")
8 8 end
  9 +
  10 + def periodicity_option(periodicity)
  11 + periodicity_options.select {|option| option.last == periodicity}.first.first
  12 + end
9 13 end
10 14 \ No newline at end of file
... ...
app/views/repositories/show.html.erb
... ... @@ -3,11 +3,31 @@
3 3 </div>
4 4  
5 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 21 <strong>Address:</strong>
7 22 <%= @repository.address %>
8 23 </p>
9 24  
10 25 <p>
  26 + <strong>Periodicity:</strong>
  27 + <%= periodicity_option(@repository.process_period) %>
  28 +</p>
  29 +
  30 +<p>
11 31 <strong>Configuration:</strong>
12 32 <%= @configuration.name %>
13 33 </p>
... ...
features/repository/edit.feature
... ... @@ -16,12 +16,16 @@ Feature: Repository Edit
16 16 Then the field "Name" should be filled with "QtCalculator"
17 17 And the field "Type" should be filled with "SUBVERSION"
18 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 21 When I fill the Name field with "MedSquare"
20 22 And I set the select field "Type" as "GIT"
21 23 And I fill the Address field with "git://git.code.sf.net/p/medsquare/git"
22 24 And I press the Save button
23 25 Then I should see "MedSquare"
24 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 30 @kalibro_restart
27 31 Scenario: editing a repository with blank fields
... ...
features/repository/show.feature
... ... @@ -3,6 +3,22 @@ Feature: Show Repository
3 3 As a regular user
4 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 22 @kalibro_restart @javascript
7 23 Scenario: With a ready processing
8 24 Given I am a regular user
... ... @@ -14,19 +30,20 @@ Feature: Show Repository
14 30 And I wait up for a ready processing
15 31 When I visit the repository show page
16 32 Then I should see the sample repository name
17   - And I should see "Address"
18   - And I should see "Configuration"
19 33 And I should see "State"
20 34 And I should see "Creation date"
21 35 And I should see "LOADING time"
22 36 And I should see "COLLECTING time"
23 37 And I should see "ANALYZING time"
24   - #TODO: test if the module results tree is getting rendered
25 38 When I click the "Metric Results" h3
26 39 Then I should see "Metric"
27 40 And I should see "Value"
28 41 And I should see "Weight"
29 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 48 @kalibro_restart @javascript
32 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 97 page.should have_content(@module_result.children.first.module.name)
98 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 107 Then(/^I should see a loaded graphic for the sample metric$/) do
101 108 while (page.driver.network_traffic.last.response_parts.empty?) do
102 109 sleep(10)
... ...
spec/helpers/repository_helper_spec.rb
... ... @@ -13,4 +13,10 @@ describe RepositoryHelper do
13 13 helper.license_options.should eq YAML.load_file("config/licenses.yml").split("; ")
14 14 end
15 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 22 end
17 23 \ No newline at end of file
... ...