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 22 Given I am logged in as "joaosilva"
23 23 And I go to /myprofile/basic-software/plugin/software_communities/edit_software
24 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 27 Scenario: Enable public software checkbox to admin users
28 28 Given I am logged in as mpog_admin
29 29 And I go to /myprofile/basic-software/plugin/software_communities/edit_software
30 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 33 @selenium
34 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 84  
85 85 Given /^the following softwares$/ do |table|
86 86 table.hashes.each do |item|
  87 + software = Software.new(:name => item[:name], :identifier => item[:name].to_slug)
  88 +
87 89 software_info = SoftwareInfo.new
88   - software_info.community = Community.create(:name=>item[:name])
  90 + software_info.software = software
89 91  
90 92 software_info.finality = item[:finality] if item[:finality]
91 93 software_info.acronym = item[:acronym] if item[:acronym]
... ... @@ -121,11 +123,12 @@ Given /^the following softwares$/ do |table|
121 123  
122 124 categories.each do |category_name|
123 125 category = Category.find_by_name category_name
124   - software_info.community.categories << category
  126 + software_info.software.categories << category
125 127 end
126 128 end
127 129  
128   - software_info.save!
  130 + software.software_info = software_info
  131 + software.save!
129 132 end
130 133 end
131 134  
... ...
src/noosfero-spb/software_communities/lib/software.rb
... ... @@ -26,4 +26,9 @@ class Software &lt; Organization
26 26 self.hits += 1
27 27 self.save!
28 28 end
  29 +
  30 + def software?
  31 + true
  32 + end
  33 +
29 34 end
... ...
src/noosfero-spb/software_communities/lib/tasks/create_sample_softwares.rake
... ... @@ -47,12 +47,11 @@ end
47 47 def create_software(name)
48 48 software = Software.new
49 49 software.name = name
50   - software.save
51 50 software
52 51 end
53 52  
54 53 def create_software_info(name, acronym = "", finality = "default")
55   - community = create_software(name)
  54 + software = create_software(name)
56 55 software_info = SoftwareInfo.new
57 56 software_info.software = software
58 57 software_info.public_software = true
... ... @@ -60,10 +59,11 @@ def create_software_info(name, acronym = &quot;&quot;, finality = &quot;default&quot;)
60 59 software_info.finality = finality
61 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 65 print "."
65   - software_info.save
66   - software_info
  66 + software.save
67 67 else
68 68 print "F"
69 69 nil
... ...
src/noosfero-spb/software_communities/views/blocks/download.html.erb
1 1 <% if block.owner.software_info.nil? %>
2 2 <%= _("This community needs a software to use this block") %>
3 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 5 <ul class="download-list">
6 6 <% block.downloads.each_with_index do |download, index| %>
7 7 <li id="download-item-<%=(index+1)%>">
... ...