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 18 And the following software databases
19 19 | database_name | version | operating_system |
20 20 | PostgreSQL | 1.0 | Linux |
  21 + And the following operating systems
  22 + | operating_system_name | version |
  23 + | Debian | 1.0 |
21 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 27 And I go to /plugin/mpog_software/archive_software
25 28 And I should see "teste"
26 29 And I follow "Deactivate software"
... ... @@ -38,10 +41,13 @@ Feature:
38 41 And the following software databases
39 42 | database_name | version | operating_system |
40 43 | PostgreSQL | 1.0 | Linux |
  44 + And the following operating systems
  45 + | operating_system_name | version |
  46 + | Debian | 1.0 |
41 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 51 And I should see "teste"
46 52 And I follow "Deactivate software"
47 53 And I confirm the "Do you want to deactivate this software?" dialog
... ... @@ -53,7 +59,7 @@ Feature:
53 59 And I should see "teste"
54 60 And I follow "Activate Software"
55 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 63 And I fill in "search-input" with "teste"
58 64 And I press "Search"
59 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 13 DatabaseDescription.create(:name => "Apache")
14 14 DatabaseDescription.create(:name => "PostgreSQL")
15 15  
16   - OperatingSystemName.create(:name=>"Debina")
  16 + OperatingSystemName.create(:name=>"Debian")
17 17 OperatingSystemName.create(:name=>"Fedora")
18 18 OperatingSystemName.create(:name=>"CentOS")
19 19 end
... ... @@ -70,6 +70,19 @@ Given /^the following software databases$/ do |table|
70 70 end
71 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 86 Given /^the following softwares$/ do |table|
74 87 table.hashes.each do |item|
75 88 community = Community.create :name=>item[:name]
... ... @@ -79,10 +92,14 @@ Given /^the following softwares$/ do |table|
79 92 software_language = SoftwareLanguage.where(:programming_language_id=>programming_language).first
80 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 98 software_info = SoftwareInfo::new(:acronym=>item[:acronym], :operating_platform=>item[:operating_platform])
83 99 software_info.community = community
84 100 software_info.software_languages << software_language
85 101 software_info.software_databases << software_database
  102 + software_info.operating_systems << operating_system
86 103 software_info.save!
87 104 end
88 105 end
... ... @@ -130,4 +147,4 @@ end
130 147  
131 148 Given /^I sleep for (\d+) seconds$/ do |time|
132 149 sleep time.to_i
133   -end
134 150 \ No newline at end of file
  151 +end
... ...