Commit ad0aca8aa38bba38054f8c6883e59f34c8b1b002

Authored by Paulo Meireles
2 parents 11b8fd73 37be7d7c

Merge branch 'mezuro-dev' into mezuro

features/step_definitions/mezuro_steps.rb
1 -When /^I create a Mezuro (project|configuration) with the following data$/ do |type, fields| 1 +When /^I create a Mezuro (project|reading group) with the following data$/ do |type, fields|
2 click_link ("Mezuro " + type) 2 click_link ("Mezuro " + type)
3 3
4 fields.rows_hash.each do |name, value| 4 fields.rows_hash.each do |name, value|
5 When %{I fill in "#{name}" with "#{value}"} 5 When %{I fill in "#{name}" with "#{value}"}
6 end 6 end
7 7
8 - if Article.find_by_name(fields.rows_hash[:Title])  
9 - return false 8 + click_button "Save"
  9 + Article.find_by_name(fields.rows_hash[:Title])
  10 +end
  11 +
  12 +When /^I create a Mezuro configuration with the following data$/ do |fields|
  13 + click_link ("Mezuro configuration")
  14 +
  15 + fields.rows_hash.each do |name, value|
  16 + if name != "Clone"
  17 + When %{I fill in "#{name}" with "#{value}"}
  18 + end
10 end 19 end
11 20
12 - click_button "Save" # Does not work without selenium? 21 + click_button "Save"
13 Article.find_by_name(fields.rows_hash[:Title]) 22 Article.find_by_name(fields.rows_hash[:Title])
14 end 23 end
15 24
@@ -25,24 +34,107 @@ Then /^I should be at the url "([^\"]*)"$/ do |url| @@ -25,24 +34,107 @@ Then /^I should be at the url "([^\"]*)"$/ do |url|
25 end 34 end
26 end 35 end
27 36
28 -Then /^I don't fill anything$/ do 37 +Then /^the field "([^"]*)" is empty$/ do |field_name|
  38 + find_field(field_name).value.should be_nil
29 end 39 end
30 40
31 Then /^I should see "([^\"]*)" inside an alert$/ do |message| 41 Then /^I should see "([^\"]*)" inside an alert$/ do |message|
32 - selenium.get_alert.should eql(message)  
33 - selenium.chooseOkOnNextConfirmation(); 42 + alert = page.driver.browser.switch_to.alert
  43 + assert_equal message, alert.text
  44 + alert.accept
  45 +end
  46 +
  47 +Then /^I should see "([^"]*)" in the "([^"]*)" input$/ do |content, labeltext|
  48 + find_field(labeltext).value.should == content
34 end 49 end
35 50
36 -When /^I have a Mezuro project with the following data$/ do |fields| 51 +Then /^I should see "([^"]*)" button$/ do |button_name|
  52 + find_button(button_name).should_not be_nil
  53 +end
  54 +
  55 +Then /^I should see "([^"]*)" in a link$/ do |link_name|
  56 + find_link(link_name).should_not be_nil
  57 +end
  58 +
  59 +Then /^I should see "([^"]*)" in the "([^"]*)" select$/ do |content, labeltext|
  60 + find_field(labeltext).value.strip.should == content #strip because have empty spaces around some options
  61 +end
  62 +
  63 +Then /^I should see "([^"]*)" in the process period select field$/ do |content|
  64 + selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first
  65 + assert_equal selected.last, find_field("repository_process_period").value.to_i
  66 +end
  67 +
  68 +Then /^I should see "([^"]*)" in the repository configuration select field$/ do |content|
  69 + selected = Kalibro::Configuration.all.select { |option| option.name == content }.first
  70 + assert_equal selected.id, find_field("repository_configuration_id").value.to_i
  71 +end
  72 +
  73 +Then /^I should not see "([^"]*)" button$/ do |button_name|
  74 + find_button(button_name).should be_nil
  75 +end
  76 +
  77 +When /^I have a Mezuro (project|reading group|configuration|repository) with the following data$/ do |type,fields|
37 item = {} 78 item = {}
38 fields.rows_hash.each do |name, value| 79 fields.rows_hash.each do |name, value|
39 - if(name=="community") 80 + if(name=="user" or name=="community")
40 item.merge!(:profile=>Profile[value]) 81 item.merge!(:profile=>Profile[value])
41 else 82 else
42 item.merge!(name => value) 83 item.merge!(name => value)
43 end 84 end
44 end 85 end
45 - result = MezuroPlugin::ProjectContent.new(item)  
46 - result.save! 86 + if (type == "project")
  87 + result = MezuroPlugin::ProjectContent.new(item)
  88 + elsif (type == "reading group")
  89 + result = MezuroPlugin::ReadingGroupContent.new(item)
  90 + elsif (type == "configuration")
  91 + result = MezuroPlugin::ConfigurationContent.new(item)
  92 + end
  93 +
  94 + if (type == "repository")
  95 + puts Kalibro::Configuration.all.last.id
  96 + puts Kalibro::Project.all.last.id
  97 + item.merge(:configuration_id => Kalibro::Configuration.all.last.id)
  98 + result = Kalibro::Repository.new(item)
  99 + result.save Kalibro::Project.all.last.id
  100 + else
  101 + result.save!
  102 + end
  103 +end
  104 +
  105 +When /^I erase the "([^"]*)" field$/ do |field_name|
  106 + find_field(field_name).set ""
  107 +end
  108 +
  109 +When /^I fill the fields with the new following data$/ do |fields|
  110 + fields.rows_hash.each do |key, value|
  111 + name = key.to_s
  112 + element = find_field(name)
  113 + if element.tag_name.to_s == "select"
  114 + select(value, :from => name)
  115 + else
  116 + element.set value
  117 + end
  118 + end
  119 +end
  120 +
  121 +When /^I have a Mezuro metric configuration with previous created configuration and reading group$/ do
  122 + Kalibro::MetricConfiguration.create({
  123 + :code => 'amloc1',
  124 + :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']},
  125 + :base_tool_name => "Analizo",
  126 + :weight => "1.0",
  127 + :aggregation_form => 'AVERAGE',
  128 + :reading_group_id => Kalibro::ReadingGroup.all.last.id,
  129 + :configuration_id => Kalibro::Configuration.all.last.id
  130 + })
47 end 131 end
48 132
  133 +When /^I follow the (edit|remove) link for "([^"]*)" repository$/ do |action,repository_name|
  134 + project_id = Kalibro::Project.all.last.id
  135 + repositories = Kalibro::Repository.repositories_of project_id
  136 + repository_id = repositories.select {|option| option.name == repository_name}.first.id
  137 + elements = all('a', :text => action.capitalize)
  138 + action_link = elements.select {|element| (/repository_id=#{repository_id}/ =~ element[:href]) }.first
  139 + action_link.click
  140 +end
features/support/hooks.rb 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +After ('@kalibro_restart') do
  2 + command = "#{RAILS_ROOT}/plugins/mezuro/script/delete_all_kalibro_entries.sh"
  3 + system command
  4 +end
plugins/mezuro/features/adding_metric_configuration.feature
@@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
1 -Feature: Add metric configuration to a configuration  
2 - As a mezuro user  
3 - I want to add metric configurations to a Kalibro configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 - And I go to the Control panel  
12 - And I create a Mezuro configuration with the following data  
13 - | Title | My Configuration |  
14 - | Description | A sample description |  
15 -  
16 - Scenario: adding a native metric configuration  
17 - When I follow "Add Metric"  
18 - And I follow "Analizo"  
19 - And I follow "Lines of Code"  
20 - And I fill in the following:  
21 - | Code: | Sample Code |  
22 - | Weight: | 10.0 |  
23 - And I select "Average" from "Aggregation Form:"  
24 - And I press "Add"  
25 - Then I should see "Lines of Code"  
26 - And I should see "Analizo"  
27 - And I should see "Sample Code"  
28 -  
29 - Scenario: adding a native metric configuration without code  
30 - When I follow "Add metric"  
31 - And I follow "Analizo"  
32 - And I follow "Number of Children"  
33 - And I don't fill anything  
34 - And I press "Add"  
35 - Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration"  
36 -  
37 - Scenario: adding a compound metric configuration  
38 - When I follow "Add Metric"  
39 - And I follow "New Compound Metric"  
40 - And I fill in the following:  
41 - | Name: | Compound sample |  
42 - | Description: | 10.0 |  
43 - | Script: | return 42; |  
44 - | Code: | anyCode |  
45 - | Weight: | 10.0 |  
46 - And I select "Class" from "Scope:"  
47 - And I select "Average" from "Aggregation Form:"  
48 - And I press "Add"  
49 - Then I should see "Compound sample"  
50 -  
51 - Scenario: adding a compound metric configuration with invalid script  
52 - When I follow "Add metric"  
53 - And I follow "New Compound Metric"  
54 - And I fill in the following:  
55 - | Name: | Compound sample |  
56 - | Description: | 10.0 |  
57 - | Script: | invalid script |  
58 - | Code: | anyCode |  
59 - | Weight: | 10.0 |  
60 - And I select "Class" from "Scope:"  
61 - And I select "Average" from "Aggregation Form:"  
62 - And I press "Add"  
63 - Then I should see "Metric with invalid code or script: invalid script"  
plugins/mezuro/features/adding_ranges.feature
@@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
1 -Feature: Add range to a metric configuration  
2 - As a mezuro user  
3 - I want to add ranges to a Kalibro metric configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 - And I go to the Control Panel  
12 - And I create a Mezuro configuration with the following data  
13 - | Title | My Configuration |  
14 - | Description | A sample description |  
15 - And I follow "Add Metric"  
16 - And I follow "Analizo"  
17 - And I follow "Lines of Code"  
18 - And I fill in the following:  
19 - | Code: | Sample Code |  
20 - | Weight: | 10.0 |  
21 - And I select "Average" from "Aggregation Form:"  
22 - And I press "Add"  
23 -  
24 - Scenario: adding a range to a metric configuration  
25 - When I follow "New Range" and wait  
26 - And I fill in the following:  
27 - | (*) Label: | label |  
28 - | (*) Beginning: | 1 |  
29 - | (*) End: | 10 |  
30 - | (*) Grade: | 100 |  
31 - | (*) Color: | FF00FF |  
32 - | Comments: | Comentário |  
33 - And I press "Save Range" and wait  
34 - Then I should see "label" within "#ranges"  
35 -  
36 - Scenario: adding a range with invalid beginning field  
37 - When I follow "New Range" and wait  
38 - And I fill in the following:  
39 - | (*) Label: | label |  
40 - | (*) Beginning: | teste |  
41 - | (*) End: | 10 |  
42 - | (*) Grade: | 100 |  
43 - | (*) Color: | FF00FF |  
44 - | Comments: | Comentário |  
45 - And I press "Save Range" and wait  
46 - Then I should see "Beginning, End and Grade must be numeric values." inside an alert  
47 -  
48 - Scenario: adding a range with beginning greater than end  
49 - When I follow "New Range" and wait  
50 - And I fill in the following:  
51 - | (*) Label: | label |  
52 - | (*) Beginning: | 100 |  
53 - | (*) End: | 10 |  
54 - | (*) Grade: | 100 |  
55 - | (*) Color: | FF00FF |  
56 - | Comments: | Comentário |  
57 - And I press "Save Range" and wait  
58 - Then I should see "End must be greater than Beginning." inside an alert  
59 -  
60 - Scenario: adding a range with no parameters  
61 - When I follow "New Range" and wait  
62 - And I dont't fill anything  
63 - And I press "Save Range" and wait  
64 - Then I should see "Please fill all fields marked with (*)." inside an alert  
plugins/mezuro/features/configuration.feature 0 → 100644
@@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
  1 +Feature: Configuration
  2 + As a mezuro user
  3 + I want to create, edit and remove a Mezuro configuration
  4 +
  5 + Background:
  6 + Given the following users
  7 + | login | name |
  8 + | joaosilva | Joao Silva |
  9 + Given I am logged in as "joaosilva"
  10 + And "Mezuro" plugin is enabled
  11 +
  12 + Scenario: I see Mezuro configurantion's input form
  13 + Given I am on joaosilva's control panel
  14 + When I follow "Mezuro configuration"
  15 + Then I should see "Title"
  16 + And I should see "Description"
  17 + And I should see "Clone Configuration"
  18 +
  19 + #TODO: Create step for Mezuro configuration with clone.
  20 + @selenium @kalibro_restart
  21 + Scenario: I create a Mezuro configuration with valid attributes without cloning
  22 + Given I am on joaosilva's control panel
  23 + When I create a Mezuro configuration with the following data
  24 + | Title | Sample Configuration |
  25 + | Description | Sample Description |
  26 + | Clone | None |
  27 + Then I should see "Sample Configuration"
  28 + And I should see "Sample Description"
  29 + And I should see "Add Metric"
  30 +
  31 + Scenario: I try to create a Mezuro configuration without title
  32 + Given I am on joaosilva's control panel
  33 + And I follow "Mezuro configuration"
  34 + And the field "article_name" is empty
  35 + When I press "Save"
  36 + Then I should see "Title can't be blank"
  37 +
  38 + @kalibro_restart
  39 + Scenario: I try to create a Mezuro configuration with title already in use
  40 + Given I have a Mezuro configuration with the following data
  41 + | name | Sample Configuration |
  42 + | description | Sample Description |
  43 + | user | joaosilva |
  44 + And I am on joaosilva's control panel
  45 + When I create a Mezuro configuration with the following data
  46 + | Title | Sample Configuration |
  47 + | Description | Sample Description |
  48 + | Clone | None |
  49 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  50 +
  51 + @selenium @kalibro_restart
  52 + Scenario: I see a Mezuro configuration edit form
  53 + Given I have a Mezuro configuration with the following data
  54 + | name | Sample Configuration |
  55 + | description | Sample Description |
  56 + | user | joaosilva |
  57 + And I am on article "Sample Configuration"
  58 + When I follow "Edit"
  59 + Then I should see "Sample Configuration" in the "article_name" input
  60 + And I should see "Sample Description" in the "article_description" input
  61 + And I should see "Save" button
  62 +
  63 + @selenium @kalibro_restart
  64 + Scenario: I edit a Mezuro configuration with valid attributes
  65 + Given I have a Mezuro configuration with the following data
  66 + | name | Sample Configuration |
  67 + | description | Sample Description |
  68 + | user | joaosilva |
  69 + And I am on article "Sample Configuration"
  70 + And I follow "Edit"
  71 + When I fill the fields with the new following data
  72 + | article_name | Another Configuration |
  73 + | article_description | Another Description |
  74 + And I press "Save"
  75 + Then I should see "Another Configuration"
  76 + And I should see "Another Description"
  77 + And I should see "Add Metric"
  78 +
  79 + @selenium @kalibro_restart
  80 + Scenario: I try to edit a Mezuro configuration leaving empty its title
  81 + Given I have a Mezuro configuration with the following data
  82 + | name | Sample Configuration |
  83 + | description | Sample Description |
  84 + | user | joaosilva |
  85 + And I am on article "Sample Configuration"
  86 + And I follow "Edit"
  87 + When I erase the "article_name" field
  88 + And I press "Save"
  89 + Then I should see "Title can't be blank"
  90 +
  91 + @selenium @kalibro_restart
  92 + Scenario: I try to edit a Mezuro configuration with title of an existing Mezuro Configuration
  93 + Given I have a Mezuro configuration with the following data
  94 + | name | Sample Configuration |
  95 + | description | Sample Description |
  96 + | user | joaosilva |
  97 + And I have a Mezuro configuration with the following data
  98 + | name | Another Configuration |
  99 + | description | Another Description |
  100 + | user | joaosilva |
  101 + And I am on article "Sample Configuration"
  102 + And I follow "Edit"
  103 + When I fill the fields with the new following data
  104 + | article_name | Another Configuration |
  105 + | article_description | Another Description |
  106 + And I press "Save"
  107 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  108 +
  109 + @selenium @kalibro_restart
  110 + Scenario: I delete a Mezuro configuration that belongs to me
  111 + Given I have a Mezuro configuration with the following data
  112 + | name | Sample Configuration |
  113 + | description | Sample Description |
  114 + | user | joaosilva |
  115 + And I am on article "Sample Configuration"
  116 + When I follow "Delete"
  117 + And I confirm the "Are you sure that you want to remove the item "Sample Configuration"?" dialog
  118 + Then I go to /joaosilva/sample-configuration
  119 + And I should see "There is no such page: /joaosilva/sample-configuration"
  120 +
  121 + @selenium @kalibro_restart
  122 + Scenario: I cannot edit or delete a Mezuro configuration that doesn't belong to me
  123 + Given I have a Mezuro configuration with the following data
  124 + | name | Sample Configuration |
  125 + | description | Sample Description |
  126 + | user | joaosilva |
  127 + And the following users
  128 + | login | name |
  129 + | adminuser | Admin |
  130 + And I am logged in as "adminuser"
  131 + When I am on article "Sample Configuration"
  132 + Then I should not see "Delete"
  133 + And I should not see "Edit"
  134 +
plugins/mezuro/features/creating_configuration.feature
@@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
1 -Feature: Create configuration  
2 - As a mezuro user  
3 - I want to create a Mezuro configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 -  
12 - Scenario: I see Mezuro Configuration on my control panel  
13 - When I go to the Control panel  
14 - Then I should see "Mezuro configuration"  
15 -  
16 - Scenario: I see an empty set of clone configurations  
17 - When I go to the Control panel  
18 - And there is no previous configurations created  
19 - And I follow "Mezuro configuration"  
20 - Then I should see "None"  
21 - And I should not see "error"  
22 -  
23 - Scenario: creating with valid attributes  
24 - When I go to the Control panel  
25 - And I create a Mezuro configuration with the following data  
26 - | Title | Qt_Calculator |  
27 - | Description | A sample description |  
28 - Then I should see "Name"  
29 - And I should see "Qt_Calculator"  
30 - And I should see "Description"  
31 - And I should see "A sample description"  
32 -  
33 - Scenario: I see a set of clone configurations  
34 - When I go to the Control panel  
35 - And I follow "Mezuro configuration"  
36 - Then I should see "None"  
37 - And I should not see "error"  
38 -  
39 - Scenario: creating with duplicated name  
40 - When I go to the Control panel  
41 - And I create a Mezuro configuration with the following data  
42 - | Title | Original Title |  
43 - And I go to the Control panel  
44 - And I create a Mezuro configuration with the following data  
45 - | Title | Original Title |  
46 - Then I should see "1 error prohibited this article from being saved"  
47 -  
48 - Scenario: creating without title  
49 - When I go to the Control panel  
50 - And I create a Mezuro configuration with the following data  
51 - | Title | |  
52 - Then I should see "1 error prohibited this article from being saved"  
53 -  
plugins/mezuro/features/editing_configuration.feature
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -Feature: editing a configuration  
2 - As a mezuro user  
3 - I want to edit a Mezuro configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 - And the following community  
12 - | identifier | name |  
13 - | mycommunity | My Community |  
14 - And "Joao Silva" is admin of "My Community"  
15 - And I am on My Community's cms  
16 - And I create a content of type "Mezuro configuration" with the following data  
17 - | Title | My Configuration |  
18 - | Description | A sample description |  
19 - And I follow "Add metric"  
20 - And I follow "Analizo"  
21 - And I follow "Lines of Code"  
22 - And I fill in the following:  
23 - | Code: | SampleCode |  
24 - | Weight: | 10.0 |  
25 - And I select "Average" from "Aggregation Form:"  
26 - And I press "Add"  
27 - And I press "Save" and wait  
28 -  
29 - Scenario: Keep metrics after editing configuration  
30 - When I follow "Edit" within "article-actions" and wait  
31 - And I press "Save"  
32 - Then I should see "Lines of Code"  
33 -  
34 - #FIXME: Create new step for this scenario  
35 - Scenario: Check if title is edit-disabled  
36 - When I follow "Edit" within "article-actions" and wait  
37 - And I fill in the following:  
38 - | Title | Some Title |  
39 - And I press "Save" and wait  
40 - Then I should not see "Some Title"  
41 -  
42 -  
43 - Scenario: Check if description is edit-enabled  
44 - When I follow "Edit" within "article-actions" and wait  
45 - And I fill in the following:  
46 - | Description | Some Description |  
47 - And I press "Save" and wait  
48 - Then I should see "Some Description"  
49 - And I should see "Lines of Code"  
plugins/mezuro/features/project.feature
@@ -13,12 +13,13 @@ Feature: Project @@ -13,12 +13,13 @@ Feature: Project
13 | mycommunity | My Community | 13 | mycommunity | My Community |
14 And "Joao Silva" is admin of "My Community" 14 And "Joao Silva" is admin of "My Community"
15 15
16 - Scenario: I see Mezuro project's input form 16 + Scenario: I see the Mezuro project input form
17 Given I am on mycommunity's control panel 17 Given I am on mycommunity's control panel
18 When I follow "Mezuro project" 18 When I follow "Mezuro project"
19 Then I should see "Title" 19 Then I should see "Title"
20 And I should see "Description" 20 And I should see "Description"
21 21
  22 + @kalibro_restart
22 Scenario: I create a Mezuro project with valid attributes 23 Scenario: I create a Mezuro project with valid attributes
23 Given I am on mycommunity's control panel 24 Given I am on mycommunity's control panel
24 When I create a Mezuro project with the following data 25 When I create a Mezuro project with the following data
@@ -28,41 +29,106 @@ Feature: Project @@ -28,41 +29,106 @@ Feature: Project
28 And I should see "Sample Description" 29 And I should see "Sample Description"
29 And I should see "Add Repository" 30 And I should see "Add Repository"
30 31
31 - @selenium  
32 - Scenario: I edit a Mezuro project  
33 - When I have a Mezuro project with the following data 32 + Scenario: I try to create a Mezuro project without title
  33 + Given I am on mycommunity's control panel
  34 + And I follow "Mezuro project"
  35 + And the field "article_name" is empty
  36 + When I press "Save"
  37 + Then I should see "Title can't be blank"
  38 +
  39 + @kalibro_restart
  40 + Scenario: I try to create a Mezuro project with title already in use
  41 + Given I have a Mezuro project with the following data
  42 + | name | Sample Project |
  43 + | description | Sample Description |
  44 + | community | mycommunity |
  45 + And I am on mycommunity's control panel
  46 + When I create a Mezuro project with the following data
  47 + | Title | Sample Project |
  48 + | Description | Sample Description |
  49 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  50 +
  51 + @selenium @kalibro_restart
  52 + Scenario: I see a Mezuro project edit form
  53 + Given I have a Mezuro project with the following data
34 | name | Sample Project | 54 | name | Sample Project |
35 | description | Sample Description | 55 | description | Sample Description |
36 | community | mycommunity | 56 | community | mycommunity |
37 And I am on article "Sample Project" 57 And I am on article "Sample Project"
38 - And I should be on /mycommunity/sample-project  
39 - Then I should see "Sample Project"  
40 - And I should see "Sample Description"  
41 - And I should see "Add Repository"  
42 When I follow "Edit" 58 When I follow "Edit"
43 - # Not complete 59 + Then I should see "Sample Project" in the "article_name" input
  60 + And I should see "Sample Description" in the "article_description" input
  61 + And I should see "Save" button
  62 +
  63 + @selenium @kalibro_restart
  64 + Scenario: I edit a Mezuro project with valid attributes
  65 + Given I have a Mezuro project with the following data
  66 + | name | Sample Project |
  67 + | description | Sample Description |
  68 + | community | mycommunity |
  69 + And I am on article "Sample Project"
  70 + And I follow "Edit"
  71 + When I fill the fields with the new following data
  72 + | article_name | Another Project |
  73 + | article_description | Another Description|
  74 + And I press "Save"
  75 + Then I should see "Another Project"
  76 + And I should see "Another Description"
  77 + And I should see "Add Repository"
  78 +
  79 + @selenium @kalibro_restart
  80 + Scenario: I try to edit a Mezuro project leaving empty its title
  81 + Given I have a Mezuro project with the following data
  82 + | name | Sample Project |
  83 + | description | Sample Description |
  84 + | community | mycommunity |
  85 + And I am on article "Sample Project"
  86 + And I follow "Edit"
  87 + When I erase the "article_name" field
  88 + And I press "Save"
  89 + Then I should see "Title can't be blank"
  90 +
  91 + @selenium @kalibro_restart
  92 + Scenario: I try to edit a Mezuro project with title of an existing Mezuro Project
  93 + Given I have a Mezuro project with the following data
  94 + | name | Sample Project |
  95 + | description | Sample Description |
  96 + | community | mycommunity |
  97 + And I have a Mezuro project with the following data
  98 + | name | Another Project |
  99 + | description | Another Description |
  100 + | community | mycommunity |
  101 + And I am on article "Sample Project"
  102 + And I follow "Edit"
  103 + When I fill the fields with the new following data
  104 + | article_name | Another Project |
  105 + | article_description | Another Description|
  106 + And I press "Save"
  107 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  108 +
  109 + @selenium @kalibro_restart
  110 + Scenario: I delete a Mezuro project that belongs to me
  111 + Given I have a Mezuro project with the following data
  112 + | name | Sample Project |
  113 + | description | Sample Description |
  114 + | community | mycommunity |
  115 + And I am on article "Sample Project"
  116 + When I follow "Delete"
  117 + And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog
  118 + Then I go to /mycommunity/sample-project
  119 + And I should see "There is no such page: /mycommunity/sample-project"
44 120
45 -# @selenium  
46 -# Scenario: I delete a Mezuro project that belongs to me  
47 -# Given the following Mezuro project  
48 -# | name | description | owner |  
49 -# | Sample Project | Sample Description | joaosilva |  
50 -# And I am on article "Sample Project"  
51 -# And I should be on /joaosilva/sample-project  
52 -# When I follow "Delete"  
53 -# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog  
54 -# Then I go to /joaosilva/sample-project  
55 -# And I should see "There is no such page: /joaosilva/sample-project"  
56 -#  
57 -# @selenium  
58 -# Scenario: I cannot delete a Mezuro project that doesn't belong to me  
59 -# Given the following Mezuro project  
60 -# | name | description | owner |  
61 -# | Sample Project | Sample Description | joaosilva |  
62 -# And I am on article "Sample Project"  
63 -# And I should be on /joaosilva/sample-project  
64 -# When I follow "Delete"  
65 -# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog  
66 -# Then I go to /joaosilva/sample-project  
67 -# And I should see "There is no such page: /joaosilva/sample-project" 121 + @selenium @kalibro_restart
  122 + Scenario: I cannot edit or delete a Mezuro project that doesn't belong to me
  123 + Given I have a Mezuro project with the following data
  124 + | name | Sample Project |
  125 + | description | Sample Description |
  126 + | community | mycommunity |
  127 + And the following users
  128 + | login | name |
  129 + | user | User |
  130 + And I am logged in as "user"
  131 + When I am on article "Sample Project"
  132 + Then I should not see "Delete"
  133 + And I should not see "Edit"
68 134
plugins/mezuro/features/reading_group.feature 0 → 100644
@@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
  1 +Feature: Reading Group
  2 + As a mezuro user
  3 + I want to create, edit and remove a Mezuro reading group
  4 +
  5 + Background:
  6 + Given the following users
  7 + | login | name |
  8 + | joaosilva | Joao Silva |
  9 + Given I am logged in as "joaosilva"
  10 + And "Mezuro" plugin is enabled
  11 +
  12 + Scenario: I see Mezuro reading group's input form
  13 + Given I am on joaosilva's control panel
  14 + When I follow "Mezuro reading group"
  15 + Then I should see "Title"
  16 + And I should see "Description"
  17 +
  18 + @kalibro_restart
  19 + Scenario: I create a Mezuro reading group with valid attributes
  20 + Given I am on joaosilva's control panel
  21 + When I create a Mezuro reading group with the following data
  22 + | Title | Sample Reading Group |
  23 + | Description | Sample Description |
  24 + Then I should see "Sample Reading Group"
  25 + And I should see "Sample Description"
  26 + And I should see "Readings"
  27 + And I should see "Add Reading"
  28 +
  29 + Scenario: I try to create a Mezuro reading group without title
  30 + Given I am on joaosilva's control panel
  31 + And I follow "Mezuro reading group"
  32 + And the field "article_name" is empty
  33 + When I press "Save"
  34 + Then I should see "Title can't be blank"
  35 +
  36 + @kalibro_restart
  37 + Scenario: I try to create a Mezuro reading group with title already in use
  38 + Given I have a Mezuro reading group with the following data
  39 + | name | Sample Reading group |
  40 + | description | Sample Description |
  41 + | user | joaosilva |
  42 + And I am on joaosilva's control panel
  43 + When I create a Mezuro reading group with the following data
  44 + | Title | Sample Reading Group |
  45 + | Description | Sample Description |
  46 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  47 +
  48 + @selenium @kalibro_restart
  49 + Scenario: I see a Mezuro reading group edit form
  50 + Given I have a Mezuro reading group with the following data
  51 + | name | Sample Reading group |
  52 + | description | Sample Description |
  53 + | user | joaosilva |
  54 + And I am on article "Sample Reading group"
  55 + When I follow "Edit"
  56 + Then I should see "Sample Reading group" in the "article_name" input
  57 + And I should see "Sample Description" in the "article_description" input
  58 + And I should see "Save" button
  59 +
  60 + @selenium @kalibro_restart
  61 + Scenario: I edit a Mezuro reading group with valid attributes
  62 + Given I have a Mezuro reading group with the following data
  63 + | name | Sample Reading group |
  64 + | description | Sample Description |
  65 + | user | joaosilva |
  66 + And I am on article "Sample Reading group"
  67 + And I follow "Edit"
  68 + When I fill the fields with the new following data
  69 + | article_name | Another Reading group |
  70 + | article_description | Another Description |
  71 + And I press "Save"
  72 + Then I should see "Another Reading group"
  73 + And I should see "Another Description"
  74 + And I should see "Add Reading"
  75 +
  76 + @selenium @kalibro_restart
  77 + Scenario: I try to edit a Mezuro reading group leaving empty its title
  78 + Given I have a Mezuro reading group with the following data
  79 + | name | Sample Reading group |
  80 + | description | Sample Description |
  81 + | user | joaosilva |
  82 + And I am on article "Sample Reading group"
  83 + And I follow "Edit"
  84 + When I erase the "article_name" field
  85 + And I press "Save"
  86 + Then I should see "Title can't be blank"
  87 +
  88 + @selenium @kalibro_restart
  89 + Scenario: I try to edit a Mezuro reading group with title of an existing Mezuro Reading group
  90 + Given I have a Mezuro reading group with the following data
  91 + | name | Sample Reading group |
  92 + | description | Sample Description |
  93 + | user | joaosilva |
  94 + And I have a Mezuro reading group with the following data
  95 + | name | Another Reading group |
  96 + | description | Another Description |
  97 + | user | joaosilva |
  98 + And I am on article "Sample Reading group"
  99 + And I follow "Edit"
  100 + When I fill the fields with the new following data
  101 + | article_name | Another Reading group |
  102 + | article_description | Another Description |
  103 + And I press "Save"
  104 + Then I should see "Slug The title (article name) is already being used by another article, please use another title."
  105 +
  106 + @selenium @kalibro_restart
  107 + Scenario: I delete a Mezuro reading group that belongs to me
  108 + Given I have a Mezuro reading group with the following data
  109 + | name | Sample Reading group |
  110 + | description | Sample Description |
  111 + | user | joaosilva |
  112 + And I am on article "Sample Reading group"
  113 + When I follow "Delete"
  114 + And I confirm the "Are you sure that you want to remove the item "Sample Reading group"?" dialog
  115 + Then I go to /joaosilva/sample-reading-group
  116 + And I should see "There is no such page: /joaosilva/sample-reading-group"
  117 +
  118 + @selenium @kalibro_restart
  119 + Scenario: I cannot edit or delete a Mezuro reading group that doesn't belong to me
  120 + Given I have a Mezuro reading group with the following data
  121 + | name | Sample Reading group |
  122 + | description | Sample Description |
  123 + | user | joaosilva |
  124 + And the following users
  125 + | login | name |
  126 + | adminuser | Admin |
  127 + And I am logged in as "adminuser"
  128 + When I am on article "Sample Reading group"
  129 + Then I should not see "Delete"
  130 + And I should not see "Edit"
  131 +
plugins/mezuro/features/removing_metric_configuration.feature
@@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
1 -Feature: Remove a metric configuration from a configuration  
2 - As a mezuro user  
3 - I want to remove metric configurations from a configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 - And the following community  
12 - | identifier | name |  
13 - | mycommunity | My Community |  
14 - And "Joao Silva" is admin of "My Community"  
15 - And I am on My Community's cms  
16 - And I create a content of type "Mezuro configuration" with the following data  
17 - | Title | My Configuration |  
18 - | Description | A sample description |  
19 - When I follow "Add metric"  
20 - And I follow "Analizo"  
21 - And I follow "Lines of Code"  
22 - And I fill in the following:  
23 - | Code: | Sample Code |  
24 - | Weight: | 10.0 |  
25 - And I select "Average" from "Aggregation Form:"  
26 - And I press "Add"  
27 - And I press "Save"  
28 - And I should see "Lines of Code"  
29 -  
30 - Scenario: I remove a metric configuration  
31 - When I follow "Remove"  
32 - Then I should not see "Lines of Code"  
plugins/mezuro/lib/mezuro_plugin.rb
@@ -28,7 +28,7 @@ class MezuroPlugin < Noosfero::Plugin @@ -28,7 +28,7 @@ class MezuroPlugin < Noosfero::Plugin
28 {:title => _('Mezuro project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' } 28 {:title => _('Mezuro project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' }
29 else 29 else
30 [{:title => _('Mezuro configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' }, 30 [{:title => _('Mezuro configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' },
31 - {:title => _('Mezuro Reading Group'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ReadingGroupContent'}, :icon => 'mezuro' }] 31 + {:title => _('Mezuro reading group'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ReadingGroupContent'}, :icon => 'mezuro' }]
32 end 32 end
33 end 33 end
34 34
plugins/mezuro/public/javascripts/validations.js
1 jQuery(function (){ 1 jQuery(function (){
2 jQuery('#range_submit').live("click", validate_new_range_configuration); 2 jQuery('#range_submit').live("click", validate_new_range_configuration);
3 jQuery('#metric_configuration_submit').live("click", validate_metric_configuration); 3 jQuery('#metric_configuration_submit').live("click", validate_metric_configuration);
  4 + jQuery('#repository_submit').live("click", validate_new_repository);
  5 + jQuery('#reading_submit').live("click", validate_new_reading);
4 }); 6 });
5 7
6 function validate_code(code){ 8 function validate_code(code){
7 return true; 9 return true;
8 } 10 }
9 11
10 -function validate_metric_configuration(){  
11 - var code = jQuery('#metric_configuration_code').val();  
12 - if (is_null(code))  
13 - {  
14 - alert("Code must be filled out");  
15 - return false;  
16 - }  
17 - return true; 12 +function allRequiredFieldsAreFilled() {
  13 + var name = jQuery('#repository_name').val();
  14 + var address = jQuery('#repository_address').val();
  15 +
  16 + if (is_null(name) || is_null(address)) {
  17 + alert("Please fill all fields marked with (*).");
  18 + return false;
  19 + }
  20 + return true;
18 } 21 }
19 22
20 -function is_null(value){  
21 - if(value == "" || value == null){  
22 - return true;  
23 - } 23 +function validate_new_reading() {
  24 + var name = jQuery('#reading_label').val();
  25 + var grade = jQuery('#reading_grade').val();
  26 + var color = jQuery('#reading_color').val();
  27 + if (is_null(name) || is_null(grade) || is_null(color)){
  28 + alert("Please fill all fields marked with (*).");
24 return false; 29 return false;
  30 + }
  31 + return true;
25 } 32 }
26 33
27 -function IsNotNumeric(value){  
28 - if(value.match(/[0-9]*\.?[0-9]+/))  
29 - {  
30 - return false;  
31 - } 34 +function validate_new_repository() {
  35 + if (allRequiredFieldsAreFilled()) {
  36 + return addressAndTypeMatch();
  37 + }
  38 + return false;
  39 +}
  40 +
  41 +function addressAndTypeMatch() {
  42 + var type = jQuery('#repository_type').val();
  43 + var address = jQuery('#repository_address').val();
  44 +
  45 + switch (type) {
  46 + case "BAZAAR": return matchBazaar(address);
  47 + case "CVS": return matchCVS(address);
  48 + case "GIT": return matchGIT(address);
  49 + case "MERCURIAL": return matchMercurial(address);
  50 + case "REMOTE_TARBALL": return matchRemoteTarball(address);
  51 + case "REMOTE_ZIP": return matchRemoteZIP(address);
  52 + case "SUBVERSION": return matchSubversion(address);
  53 + }
  54 +}
  55 +
  56 +function matchBazaar(address) {
  57 + if (address.match(/bzr/)) {
  58 + return true;
  59 + }
  60 + alert("Address does not match type BAZAAR chosen.");
  61 + return false;
  62 +}
  63 +
  64 +function matchCVS(address) {
  65 + if (address.match(/cvs/)) {
  66 + return true;
  67 + }
  68 + alert("Address does not match type CVS chosen.");
  69 + return false;
  70 +}
  71 +
  72 +function matchGIT(address) {
  73 + if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) {
  74 + return true;
  75 + }
  76 + alert("Address does not match type GIT chosen.");
  77 + return false;
  78 +}
  79 +
  80 +function matchMercurial(address) {
  81 + if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) {
  82 + return true;
  83 + }
  84 + alert("Address does not match type MERCURIAL chosen.");
  85 + return false;
  86 +}
  87 +
  88 +function matchRemoteTarball(address) {
  89 + if (address.match(/\.tar(\..+)*$/)) {
32 return true; 90 return true;
  91 + }
  92 + alert("Address does not match type REMOTE_TARBALL chosen.");
  93 + return false;
33 } 94 }
34 95
35 -function IsNotInfinite(value){  
36 - if(value.match(/INF/)){ 96 +function matchRemoteZIP(address) {
  97 + if (address.match(/\.zip$/)) {
  98 + return true;
  99 + }
  100 + alert("Address does not match type REMOTE_ZIP chosen.");
  101 + return false;
  102 +}
  103 +
  104 +function matchSubversion(address) {
  105 + if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) {
  106 + return true;
  107 + }
  108 + alert("Address does not match type SUBVERSION chosen.");
  109 + return false;
  110 +}
  111 +
  112 +function validate_metric_configuration() {
  113 + var code = jQuery('#metric_configuration_code').val();
  114 + if (is_null(code)) {
  115 + alert("Code must be filled out");
37 return false; 116 return false;
38 - } 117 + }
  118 + return true;
  119 +}
  120 +
  121 +function is_null(value) {
  122 + if (value == "" || value == null) {
39 return true; 123 return true;
  124 + }
  125 + return false;
  126 +}
  127 +
  128 +function IsNotNumeric(value) {
  129 + if (value.match(/[0-9]*\.?[0-9]+/)) {
  130 + return false;
  131 + }
  132 + return true;
40 } 133 }
41 134
42 -function validate_new_range_configuration(event){  
43 - var beginning = jQuery("#range_beginning").val();  
44 - var end = jQuery("#range_end").val(); 135 +function IsNotInfinite(value) {
  136 + if (value.match(/INF/)) {
  137 + return false;
  138 + }
  139 + return true;
  140 +}
45 141
46 - if (is_null(beginning) || is_null(end))  
47 - {  
48 - alert("Please fill all fields marked with (*).");  
49 - return false;  
50 - }  
51 - if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end)))  
52 - {  
53 - alert("Beginning, End and Grade must be numeric values."); 142 +function validate_new_range_configuration(event) {
  143 + var beginning = jQuery("#range_beginning").val();
  144 + var end = jQuery("#range_end").val();
  145 +
  146 + if (is_null(beginning) || is_null(end)) {
  147 + alert("Please fill all fields marked with (*).");
  148 + return false;
  149 + }
  150 + if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end))) {
  151 + alert("Beginning, End and Grade must be numeric values.");
  152 + return false;
  153 + }
  154 + if (parseInt(beginning) > parseInt(end)) {
  155 + if (IsNotInfinite(beginning) && IsNotInfinite(end)) {
  156 + alert("End must be greater than Beginning.");
54 return false; 157 return false;
55 - }  
56 - if (parseInt(beginning) > parseInt(end))  
57 - {  
58 - if(IsNotInfinite(beginning) && IsNotInfinite(end)){  
59 - alert("End must be greater than Beginning.");  
60 - return false;  
61 - }  
62 - }  
63 - return true; 158 + }
  159 + }
  160 + return true;
64 } 161 }
plugins/mezuro/script/delete_all_kalibro_entries.sh 0 → 100755
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +#!/bin/bash
  2 +
  3 +DATABASE="kalibro_tests"
  4 +USER="kalibro"
  5 +PASSWORD="kalibro"
  6 +MYSQL_PARAMS="$DATABASE -u $USER -p$PASSWORD"
  7 +TABLES=($(mysql $MYSQL_PARAMS -e "show tables"))
  8 +LENGTH=${#TABLES}
  9 +
  10 +i=1
  11 +while [ $i -le $LENGTH ]
  12 + do if [ ${#TABLES[$i]} -ne 0 ]
  13 + then mysql $MYSQL_PARAMS -e "SET FOREIGN_KEY_CHECKS = 0; delete from $DATABASE.${TABLES[$i]}; SET FOREIGN_KEY_CHECKS = 1;"
  14 + fi
  15 + i=$(($i+1))
  16 +done
0 \ No newline at end of file 17 \ No newline at end of file
plugins/mezuro/script/run_acceptance_tests.sh 0 → 100755
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +#!/bin/bash
  2 +
  3 +TEST_FILE=$1
  4 +PROFILE=$2
  5 +
  6 +if [ -z "$PROFILE" ]; then
  7 + PROFILE='default'
  8 +fi
  9 +
  10 +# where are your .kalibro dir?
  11 +KALIBRO_HOME='/usr/share/tomcat6/.kalibro'
  12 +
  13 +# create a kalibro test dir
  14 +echo "--> Creating tests directory"
  15 +sudo mkdir $KALIBRO_HOME/tests
  16 +echo "--> Copying test settings"
  17 +sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings
  18 +echo "--> Changing owner of tests directory to tomcat6"
  19 +sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests
  20 +
  21 +# you must restart tomcat6
  22 +#if you are using a tomcat installed from apt-get, for example:
  23 +sudo service tomcat6 restart
  24 +
  25 +#if you are using a tomcat installed a specific dir, for exemple:
  26 +#~/tomcat6/bin/shoutdown.sh
  27 +#~/tomcat6/bin/startup.sh
  28 +
  29 +# run test
  30 +cucumber $TEST_FILE -p $PROFILE
  31 +
  32 +#back to normal mode
  33 +echo "--> Removing tests directory"
  34 +sudo rm -rf $KALIBRO_HOME/tests
  35 +
  36 +# you must restart tomcat6 again
  37 +sudo service tomcat6 restart
  38 +
  39 +#or some thing like that...
  40 +#~/tomcat6/bin/shoutdown.sh
  41 +#~/tomcat6/bin/startup.sh
  42 +
plugins/mezuro/test/fixtures/metric_fixtures.rb
@@ -13,7 +13,7 @@ class MetricFixtures @@ -13,7 +13,7 @@ class MetricFixtures
13 end 13 end
14 14
15 def self.total_cof_hash 15 def self.total_cof_hash
16 - {:name => 'Total Coupling Factor', :compound => "false", :scope => 'APPLICATION', :language => ['JAVA']} 16 + {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}
17 end 17 end
18 18
19 def self.amloc 19 def self.amloc
plugins/mezuro/test/run_acceptance_tests.sh
@@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -TEST_FILE=$1  
4 -PROFILE=$2  
5 -  
6 -if [ -z "$PROFILE" ]; then  
7 - PROFILE='default'  
8 -fi  
9 -  
10 -# where are your .kalibro dir?  
11 -KALIBRO_HOME='/usr/share/tomcat6/.kalibro'  
12 -  
13 -# create a kalibro test dir  
14 -echo "--> Creating tests directory"  
15 -sudo mkdir $KALIBRO_HOME/tests  
16 -echo "--> Copying test settings"  
17 -sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings  
18 -echo "--> Changing owner of tests directory to tomcat6"  
19 -sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests  
20 -  
21 -# you must restart tomcat6  
22 -#if you are using a tomcat installed from apt-get, for example:  
23 -sudo service tomcat6 restart  
24 -  
25 -#if you are using a tomcat installed a specific dir, for exemple:  
26 -#~/tomcat6/bin/shoutdown.sh  
27 -#~/tomcat6/bin/startup.sh  
28 -  
29 -# run test  
30 -cucumber $TEST_FILE -p $PROFILE  
31 -  
32 -#back to normal mode  
33 -echo "--> Removing tests directory"  
34 -sudo rm -rf $KALIBRO_HOME/tests  
35 -  
36 -# you must restart tomcat6 again  
37 -sudo service tomcat6 restart  
38 -  
39 -#or some thing like that...  
40 -#~/tomcat6/bin/shoutdown.sh  
41 -#~/tomcat6/bin/startup.sh  
42 -  
plugins/mezuro/views/content_viewer/show_reading_group.rhtml
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 </table> 41 </table>
42 42
43 <br/> 43 <br/>
44 - <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Reading", :controller => "mezuro_plugin_reading", 44 + <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Reading", :controller => "mezuro_plugin_reading",
45 :profile => @page.profile.identifier, 45 :profile => @page.profile.identifier,
46 :action => "new", 46 :action => "new",
47 :id => @page.id %><br/> 47 :id => @page.id %><br/>
plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb
1 <%= hidden_field_tag :id, @reading_group_content.id %> 1 <%= hidden_field_tag :id, @reading_group_content.id %>
2 2
3 -<%= required labelled_form_field _('label:'), f.text_field(:label) %> 3 +<%= required labelled_form_field _('Label:'), f.text_field(:label) %>
4 4
5 -<%= required labelled_form_field _('grade:'),  
6 -f.text_field(:grade) %> 5 +<%= required labelled_form_field _('Grade:'), f.text_field(:grade) %>
7 6
8 -<%= required labelled_form_field _('color:'), 7 +<%= required labelled_form_field _('Color:'),
9 colorpicker_field(:reading, :color) %>Click in the field to change Color 8 colorpicker_field(:reading, :color) %>Click in the field to change Color
10 9
11 <p><%= f.submit "Save" %></p> 10 <p><%= f.submit "Save" %></p>
plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb
1 <script src="/javascripts/colorpicker.js" type="text/javascript"></script> 1 <script src="/javascripts/colorpicker.js" type="text/javascript"></script>
2 <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> 2 <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script>
  3 +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>
  4 +
3 <h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2> 5 <h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2>
4 6
5 <% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> 7 <% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %>
plugins/mezuro/views/mezuro_plugin_reading/new.html.erb
1 <script src="/javascripts/colorpicker.js" type="text/javascript"></script> 1 <script src="/javascripts/colorpicker.js" type="text/javascript"></script>
2 <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> 2 <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script>
  3 +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>
  4 +
3 <h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2> 5 <h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2>
4 6
5 <% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> 7 <% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %>
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
  1 +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>
  2 +
1 <%= render :partial => "form" %> 3 <%= render :partial => "form" %>
plugins/mezuro/views/mezuro_plugin_repository/new.html.erb
  1 +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>
  2 +
1 <%= render :partial => "form" %> 3 <%= render :partial => "form" %>