Commit 1d194ed0e2a9e054ec9d88212338662289c5e8b7

Authored by Marcos Pereira
1 parent cf48d6e2

fixs some cucumber tests and minor changes

partially-fix create_sample_softwares

Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
src/noosfero-spb/software_communities/features/public_software_validation.feature
@@ -22,13 +22,13 @@ Feature: edit adherent fields @@ -22,13 +22,13 @@ Feature: edit adherent fields
22 Given I am logged in as "joaosilva" 22 Given I am logged in as "joaosilva"
23 And I go to /myprofile/basic-software/plugin/software_communities/edit_software 23 And I go to /myprofile/basic-software/plugin/software_communities/edit_software
24 And I follow "Specifications" 24 And I follow "Specifications"
25 - Then I should see "Public software" within ".public_software_disabled" 25 + Then the "Public Software" checkbox within "software_public_software" should not be checked
26 26
27 Scenario: Enable public software checkbox to admin users 27 Scenario: Enable public software checkbox to admin users
28 Given I am logged in as mpog_admin 28 Given I am logged in as mpog_admin
29 And I go to /myprofile/basic-software/plugin/software_communities/edit_software 29 And I go to /myprofile/basic-software/plugin/software_communities/edit_software
30 And I follow "Specifications" 30 And I follow "Specifications"
31 - Then I should see "Public software" within ".public_software_enabled" 31 + Then the "Public Software" checkbox within "software_public_software" should be checked
32 32
33 @selenium 33 @selenium
34 Scenario: Show adherent fields when checkbox are checked 34 Scenario: Show adherent fields when checkbox are checked
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
@@ -84,8 +84,10 @@ end @@ -84,8 +84,10 @@ end
84 84
85 Given /^the following softwares$/ do |table| 85 Given /^the following softwares$/ do |table|
86 table.hashes.each do |item| 86 table.hashes.each do |item|
  87 + software = Software.new(:name => item[:name], :identifier => item[:name].to_slug)
  88 +
87 software_info = SoftwareInfo.new 89 software_info = SoftwareInfo.new
88 - software_info.community = Community.create(:name=>item[:name]) 90 + software_info.software = software
89 91
90 software_info.finality = item[:finality] if item[:finality] 92 software_info.finality = item[:finality] if item[:finality]
91 software_info.acronym = item[:acronym] if item[:acronym] 93 software_info.acronym = item[:acronym] if item[:acronym]
@@ -121,11 +123,12 @@ Given /^the following softwares$/ do |table| @@ -121,11 +123,12 @@ Given /^the following softwares$/ do |table|
121 123
122 categories.each do |category_name| 124 categories.each do |category_name|
123 category = Category.find_by_name category_name 125 category = Category.find_by_name category_name
124 - software_info.community.categories << category 126 + software_info.software.categories << category
125 end 127 end
126 end 128 end
127 129
128 - software_info.save! 130 + software.software_info = software_info
  131 + software.save!
129 end 132 end
130 end 133 end
131 134
src/noosfero-spb/software_communities/lib/software.rb
@@ -26,4 +26,9 @@ class Software &lt; Organization @@ -26,4 +26,9 @@ class Software &lt; Organization
26 self.hits += 1 26 self.hits += 1
27 self.save! 27 self.save!
28 end 28 end
  29 +
  30 + def software?
  31 + true
  32 + end
  33 +
29 end 34 end
src/noosfero-spb/software_communities/lib/tasks/create_sample_softwares.rake
@@ -47,12 +47,11 @@ end @@ -47,12 +47,11 @@ end
47 def create_software(name) 47 def create_software(name)
48 software = Software.new 48 software = Software.new
49 software.name = name 49 software.name = name
50 - software.save  
51 software 50 software
52 end 51 end
53 52
54 def create_software_info(name, acronym = "", finality = "default") 53 def create_software_info(name, acronym = "", finality = "default")
55 - community = create_software(name) 54 + software = create_software(name)
56 software_info = SoftwareInfo.new 55 software_info = SoftwareInfo.new
57 software_info.software = software 56 software_info.software = software
58 software_info.public_software = true 57 software_info.public_software = true
@@ -60,10 +59,11 @@ def create_software_info(name, acronym = &quot;&quot;, finality = &quot;default&quot;) @@ -60,10 +59,11 @@ def create_software_info(name, acronym = &quot;&quot;, finality = &quot;default&quot;)
60 software_info.finality = finality 59 software_info.finality = finality
61 software_info.license_info = LicenseInfo.first 60 software_info.license_info = LicenseInfo.first
62 61
63 - if software_info.softare.valid? && software_info.valid? 62 + software.software_info = software_info
  63 +
  64 + if software_info.software.valid? && software_info.valid?
64 print "." 65 print "."
65 - software_info.save  
66 - software_info 66 + software.save
67 else 67 else
68 print "F" 68 print "F"
69 nil 69 nil
src/noosfero-spb/software_communities/views/blocks/download.html.erb
1 <% if block.owner.software_info.nil? %> 1 <% if block.owner.software_info.nil? %>
2 <%= _("This community needs a software to use this block") %> 2 <%= _("This community needs a software to use this block") %>
3 <% else %> 3 <% else %>
4 - <h3 class="block-title"> <%= _("Download #{block.owner.software_info.community.name}") %> </h3> 4 + <h3 class="block-title"> <%= _("Download #{block.owner.software_info.software.name}") %> </h3>
5 <ul class="download-list"> 5 <ul class="download-list">
6 <% block.downloads.each_with_index do |download, index| %> 6 <% block.downloads.each_with_index do |download, index| %>
7 <li id="download-item-<%=(index+1)%>"> 7 <li id="download-item-<%=(index+1)%>">