From dd4de5fdb3b4170eae38c824292ea48916572deb Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Tue, 22 Jul 2014 18:56:03 +0000 Subject: [PATCH] Fix tests of manage software --- features/manage_software.feature | 18 ++++++++++++------ features/step_definitions/mpog_steps.rb | 21 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/features/manage_software.feature b/features/manage_software.feature index 06a4544..424d3f6 100644 --- a/features/manage_software.feature +++ b/features/manage_software.feature @@ -18,9 +18,12 @@ Feature: And the following software databases | database_name | version | operating_system | | PostgreSQL | 1.0 | Linux | + And the following operating systems + | operating_system_name | version | + | Debian | 1.0 | And the following softwares - | name | acronym | operating_platform | software_language | software_database | - | teste | ts | I dont know | Python | PostgreSQL | + | name | acronym | operating_platform | software_language | software_database | operating_system| + | teste | ts | I dont know | Python | PostgreSQL | Debian | And I go to /plugin/mpog_software/archive_software And I should see "teste" And I follow "Deactivate software" @@ -38,10 +41,13 @@ Feature: And the following software databases | database_name | version | operating_system | | PostgreSQL | 1.0 | Linux | + And the following operating systems + | operating_system_name | version | + | Debian | 1.0 | And the following softwares - | name | acronym | operating_platform | software_language | software_database | - | teste | ts | I dont know | Python | PostgreSQL | - And I go to /plugin/mpog_software/archive_software + | name | acronym | operating_platform | software_language | software_database | operating_system| + | teste | ts | I dont know | Python | PostgreSQL | Debian | + And I go to /plugin/mpog_software/archive_software And I should see "teste" And I follow "Deactivate software" And I confirm the "Do you want to deactivate this software?" dialog @@ -53,7 +59,7 @@ Feature: And I should see "teste" And I follow "Activate Software" And I confirm the "Do you want to activate this software?" dialog - And I follow "Communities" + And I go to /search/communities And I fill in "search-input" with "teste" And I press "Search" Then I should see "teste" within "search-profile-item" diff --git a/features/step_definitions/mpog_steps.rb b/features/step_definitions/mpog_steps.rb index 759311c..f033267 100644 --- a/features/step_definitions/mpog_steps.rb +++ b/features/step_definitions/mpog_steps.rb @@ -13,7 +13,7 @@ Given /^SoftwareInfo has initial default values on database$/ do DatabaseDescription.create(:name => "Apache") DatabaseDescription.create(:name => "PostgreSQL") - OperatingSystemName.create(:name=>"Debina") + OperatingSystemName.create(:name=>"Debian") OperatingSystemName.create(:name=>"Fedora") OperatingSystemName.create(:name=>"CentOS") end @@ -70,6 +70,19 @@ Given /^the following software databases$/ do |table| end end + +Given /^the following operating systems$/ do |table| + table.hashes.each do |item| + operating_system_name = OperatingSystemName.where(:name=>item[:operating_system_name]).first + operating_system = OperatingSystem::new + + operating_system.operating_system_name = operating_system_name + operating_system.version = item[:version] + + operating_system.save! + end +end + Given /^the following softwares$/ do |table| table.hashes.each do |item| community = Community.create :name=>item[:name] @@ -79,10 +92,14 @@ Given /^the following softwares$/ do |table| software_language = SoftwareLanguage.where(:programming_language_id=>programming_language).first software_database = SoftwareDatabase.where(:database_description_id=>database_description).first + operating_system_name = OperatingSystemName.where(:name => item[:operating_system]).first + operating_system = OperatingSystem.where(:operating_system_name_id => operating_system_name).first + software_info = SoftwareInfo::new(:acronym=>item[:acronym], :operating_platform=>item[:operating_platform]) software_info.community = community software_info.software_languages << software_language software_info.software_databases << software_database + software_info.operating_systems << operating_system software_info.save! end end @@ -130,4 +147,4 @@ end Given /^I sleep for (\d+) seconds$/ do |time| sleep time.to_i -end \ No newline at end of file +end -- libgit2 0.21.2