Commit dd4de5fdb3b4170eae38c824292ea48916572deb

Authored by Gabriela Navarro
1 parent 0f28f08f

Fix tests of manage software

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
features/manage_software.feature
@@ -18,9 +18,12 @@ Feature: @@ -18,9 +18,12 @@ Feature:
18 And the following software databases 18 And the following software databases
19 | database_name | version | operating_system | 19 | database_name | version | operating_system |
20 | PostgreSQL | 1.0 | Linux | 20 | PostgreSQL | 1.0 | Linux |
  21 + And the following operating systems
  22 + | operating_system_name | version |
  23 + | Debian | 1.0 |
21 And the following softwares 24 And the following softwares
22 - | name | acronym | operating_platform | software_language | software_database |  
23 - | teste | ts | I dont know | Python | PostgreSQL | 25 + | name | acronym | operating_platform | software_language | software_database | operating_system|
  26 + | teste | ts | I dont know | Python | PostgreSQL | Debian |
24 And I go to /plugin/mpog_software/archive_software 27 And I go to /plugin/mpog_software/archive_software
25 And I should see "teste" 28 And I should see "teste"
26 And I follow "Deactivate software" 29 And I follow "Deactivate software"
@@ -38,10 +41,13 @@ Feature: @@ -38,10 +41,13 @@ Feature:
38 And the following software databases 41 And the following software databases
39 | database_name | version | operating_system | 42 | database_name | version | operating_system |
40 | PostgreSQL | 1.0 | Linux | 43 | PostgreSQL | 1.0 | Linux |
  44 + And the following operating systems
  45 + | operating_system_name | version |
  46 + | Debian | 1.0 |
41 And the following softwares 47 And the following softwares
42 - | name | acronym | operating_platform | software_language | software_database |  
43 - | teste | ts | I dont know | Python | PostgreSQL |  
44 - And I go to /plugin/mpog_software/archive_software 48 + | name | acronym | operating_platform | software_language | software_database | operating_system|
  49 + | teste | ts | I dont know | Python | PostgreSQL | Debian |
  50 + And I go to /plugin/mpog_software/archive_software
45 And I should see "teste" 51 And I should see "teste"
46 And I follow "Deactivate software" 52 And I follow "Deactivate software"
47 And I confirm the "Do you want to deactivate this software?" dialog 53 And I confirm the "Do you want to deactivate this software?" dialog
@@ -53,7 +59,7 @@ Feature: @@ -53,7 +59,7 @@ Feature:
53 And I should see "teste" 59 And I should see "teste"
54 And I follow "Activate Software" 60 And I follow "Activate Software"
55 And I confirm the "Do you want to activate this software?" dialog 61 And I confirm the "Do you want to activate this software?" dialog
56 - And I follow "Communities" 62 + And I go to /search/communities
57 And I fill in "search-input" with "teste" 63 And I fill in "search-input" with "teste"
58 And I press "Search" 64 And I press "Search"
59 Then I should see "teste" within "search-profile-item" 65 Then I should see "teste" within "search-profile-item"
features/step_definitions/mpog_steps.rb
@@ -13,7 +13,7 @@ Given /^SoftwareInfo has initial default values on database$/ do @@ -13,7 +13,7 @@ Given /^SoftwareInfo has initial default values on database$/ do
13 DatabaseDescription.create(:name => "Apache") 13 DatabaseDescription.create(:name => "Apache")
14 DatabaseDescription.create(:name => "PostgreSQL") 14 DatabaseDescription.create(:name => "PostgreSQL")
15 15
16 - OperatingSystemName.create(:name=>"Debina") 16 + OperatingSystemName.create(:name=>"Debian")
17 OperatingSystemName.create(:name=>"Fedora") 17 OperatingSystemName.create(:name=>"Fedora")
18 OperatingSystemName.create(:name=>"CentOS") 18 OperatingSystemName.create(:name=>"CentOS")
19 end 19 end
@@ -70,6 +70,19 @@ Given /^the following software databases$/ do |table| @@ -70,6 +70,19 @@ Given /^the following software databases$/ do |table|
70 end 70 end
71 end 71 end
72 72
  73 +
  74 +Given /^the following operating systems$/ do |table|
  75 + table.hashes.each do |item|
  76 + operating_system_name = OperatingSystemName.where(:name=>item[:operating_system_name]).first
  77 + operating_system = OperatingSystem::new
  78 +
  79 + operating_system.operating_system_name = operating_system_name
  80 + operating_system.version = item[:version]
  81 +
  82 + operating_system.save!
  83 + end
  84 +end
  85 +
73 Given /^the following softwares$/ do |table| 86 Given /^the following softwares$/ do |table|
74 table.hashes.each do |item| 87 table.hashes.each do |item|
75 community = Community.create :name=>item[:name] 88 community = Community.create :name=>item[:name]
@@ -79,10 +92,14 @@ Given /^the following softwares$/ do |table| @@ -79,10 +92,14 @@ Given /^the following softwares$/ do |table|
79 software_language = SoftwareLanguage.where(:programming_language_id=>programming_language).first 92 software_language = SoftwareLanguage.where(:programming_language_id=>programming_language).first
80 software_database = SoftwareDatabase.where(:database_description_id=>database_description).first 93 software_database = SoftwareDatabase.where(:database_description_id=>database_description).first
81 94
  95 + operating_system_name = OperatingSystemName.where(:name => item[:operating_system]).first
  96 + operating_system = OperatingSystem.where(:operating_system_name_id => operating_system_name).first
  97 +
82 software_info = SoftwareInfo::new(:acronym=>item[:acronym], :operating_platform=>item[:operating_platform]) 98 software_info = SoftwareInfo::new(:acronym=>item[:acronym], :operating_platform=>item[:operating_platform])
83 software_info.community = community 99 software_info.community = community
84 software_info.software_languages << software_language 100 software_info.software_languages << software_language
85 software_info.software_databases << software_database 101 software_info.software_databases << software_database
  102 + software_info.operating_systems << operating_system
86 software_info.save! 103 software_info.save!
87 end 104 end
88 end 105 end
@@ -130,4 +147,4 @@ end @@ -130,4 +147,4 @@ end
130 147
131 Given /^I sleep for (\d+) seconds$/ do |time| 148 Given /^I sleep for (\d+) seconds$/ do |time|
132 sleep time.to_i 149 sleep time.to_i
133 -end  
134 \ No newline at end of file 150 \ No newline at end of file
  151 +end