Commit a9c44bb83a517d0b8cf3037a4dae9bc9b139938f
1 parent
d5e76a19
Exists in
stable-spb-1.4
Removes a plugin step that shouldn't be on core
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
1 changed file
with
0 additions
and
283 deletions
Show diff stats
features/step_definitions/software_communities_steps.rb
... | ... | @@ -1,283 +0,0 @@ |
1 | -Given /^SoftwareInfo has initial default values on database$/ do | |
2 | - LicenseInfo.create(:version=>"None", :link=>"") | |
3 | - LicenseInfo.create(:version=>"GPL-2", :link =>"www.gpl2.com") | |
4 | - LicenseInfo.create(:version=>"GPL-3", :link =>"www.gpl3.com") | |
5 | - | |
6 | - ProgrammingLanguage.create(:name=>"C") | |
7 | - ProgrammingLanguage.create(:name=>"C++") | |
8 | - ProgrammingLanguage.create(:name=>"Ruby") | |
9 | - ProgrammingLanguage.create(:name=>"Python") | |
10 | - | |
11 | - DatabaseDescription.create(:name => "Oracle") | |
12 | - DatabaseDescription.create(:name => "MySQL") | |
13 | - DatabaseDescription.create(:name => "Apache") | |
14 | - DatabaseDescription.create(:name => "PostgreSQL") | |
15 | - | |
16 | - OperatingSystemName.create(:name=>"Debian") | |
17 | - OperatingSystemName.create(:name=>"Fedora") | |
18 | - OperatingSystemName.create(:name=>"CentOS") | |
19 | -end | |
20 | - | |
21 | -Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| | |
22 | - # Wait the page javascript load | |
23 | - sleep 1 | |
24 | - # Basicaly it, search for the input field, type something, wait for ajax end select an item | |
25 | - page.driver.browser.execute_script %Q{ | |
26 | - var search_query = "#{input_field_selector}.ui-autocomplete-input"; | |
27 | - var input = jQuery(search_query).first(); | |
28 | - | |
29 | - input.trigger('click'); | |
30 | - input.val('#{typed}'); | |
31 | - input.trigger('keydown'); | |
32 | - | |
33 | - window.setTimeout(function(){ | |
34 | - search_query = ".ui-menu-item a:contains('#{should_select}')"; | |
35 | - var typed = jQuery(search_query).first(); | |
36 | - | |
37 | - typed.trigger('mouseenter').trigger('click'); | |
38 | - console.log(jQuery('#license_info_id')); | |
39 | - }, 1000); | |
40 | - } | |
41 | - sleep 1 | |
42 | -end | |
43 | - | |
44 | -Given /^Institutions has initial default values on database$/ do | |
45 | - GovernmentalPower.create(:name => "Executivo") | |
46 | - GovernmentalPower.create(:name => "Legislativo") | |
47 | - GovernmentalPower.create(:name => "Judiciario") | |
48 | - | |
49 | - GovernmentalSphere.create(:name => "Federal") | |
50 | - | |
51 | - JuridicalNature.create(:name => "Autarquia") | |
52 | - JuridicalNature.create(:name => "Administracao Direta") | |
53 | - JuridicalNature.create(:name => "Empresa Publica") | |
54 | - JuridicalNature.create(:name => "Fundacao") | |
55 | - JuridicalNature.create(:name => "Orgao Autonomo") | |
56 | - JuridicalNature.create(:name => "Sociedade") | |
57 | - JuridicalNature.create(:name => "Sociedade Civil") | |
58 | - JuridicalNature.create(:name => "Sociedade de Economia Mista") | |
59 | - | |
60 | - national_region = NationalRegion.new | |
61 | - national_region.name = "Distrito Federal" | |
62 | - national_region.national_region_code = '35' | |
63 | - national_region.national_region_type_id = NationalRegionType::STATE | |
64 | - national_region.save | |
65 | -end | |
66 | - | |
67 | -Given /^the following organization ratings$/ do |table| | |
68 | - table.hashes.each do |item| | |
69 | - person = User.where(login: item[:user_login]).first.person | |
70 | - organization = Organization.where(name: item[:organization_name]).first | |
71 | - | |
72 | - rating = OrganizationRating.new | |
73 | - rating.value = item[:value] | |
74 | - rating.organization_id = organization.id | |
75 | - rating.person_id = person.id | |
76 | - rating.saved_value = item[:saved_value] | |
77 | - rating.institution_id = Institution.where(name: item[:institution_name]).first.id | |
78 | - rating.save | |
79 | - | |
80 | - comment_task = CreateOrganizationRatingComment.create!( | |
81 | - :body => "empty comment", | |
82 | - :requestor => person, | |
83 | - :organization_rating_id => rating.id, | |
84 | - :target => organization) | |
85 | - | |
86 | - comment_task.status = item[:task_status] | |
87 | - comment_task.save | |
88 | - end | |
89 | -end | |
90 | - | |
91 | -Given /^the following public institutions?$/ do |table| | |
92 | - # table is a Cucumber::Ast::Table | |
93 | - table.hashes.each do |item| | |
94 | - community = Community.new | |
95 | - community.name = item[:name] | |
96 | - community.country = item[:country] | |
97 | - community.state = item[:state] | |
98 | - community.city = item[:city] | |
99 | - community.save! | |
100 | - | |
101 | - governmental_power = GovernmentalPower.where(:name => item[:governmental_power]).first | |
102 | - governmental_sphere = GovernmentalSphere.where(:name => item[:governmental_sphere]).first | |
103 | - | |
104 | - juridical_nature = JuridicalNature.create(:name => item[:juridical_nature]) | |
105 | - | |
106 | - institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere) | |
107 | - institution.community = community | |
108 | - institution.corporate_name = item[:corporate_name] | |
109 | - institution.save! | |
110 | - end | |
111 | -end | |
112 | - | |
113 | -Given /^the following software language$/ do |table| | |
114 | - table.hashes.each do |item| | |
115 | - programming_language = ProgrammingLanguage.where(:name=>item[:programing_language]).first | |
116 | - software_language = SoftwareLanguage::new | |
117 | - | |
118 | - software_language.programming_language = programming_language | |
119 | - software_language.version = item[:version] | |
120 | - software_language.operating_system = item[:operating_system] | |
121 | - | |
122 | - software_language.save! | |
123 | - end | |
124 | -end | |
125 | - | |
126 | -Given /^the following software databases$/ do |table| | |
127 | - table.hashes.each do |item| | |
128 | - database_description = DatabaseDescription.where(:name=>item[:database_name]).first | |
129 | - software_database = SoftwareDatabase::new | |
130 | - | |
131 | - software_database.database_description = database_description | |
132 | - software_database.version = item[:version] | |
133 | - software_database.operating_system = item[:operating_system] | |
134 | - | |
135 | - software_database.save! | |
136 | - end | |
137 | -end | |
138 | - | |
139 | - | |
140 | -Given /^the following operating systems$/ do |table| | |
141 | - table.hashes.each do |item| | |
142 | - operating_system_name = OperatingSystemName.where(:name=>item[:operating_system_name]).first | |
143 | - operating_system = OperatingSystem::new | |
144 | - | |
145 | - operating_system.operating_system_name = operating_system_name | |
146 | - operating_system.version = item[:version] | |
147 | - | |
148 | - operating_system.save! | |
149 | - end | |
150 | -end | |
151 | - | |
152 | -Given /^the following softwares$/ do |table| | |
153 | - table.hashes.each do |item| | |
154 | - software_info = SoftwareInfo.new | |
155 | - community = Community.create(:name=>item[:name]) | |
156 | - software_info.community = community | |
157 | - | |
158 | - software_info.finality = item[:finality] if item[:finality] | |
159 | - software_info.acronym = item[:acronym] if item[:acronym] | |
160 | - software_info.finality = item[:finality] if item[:finality] | |
161 | - software_info.finality ||= "something" | |
162 | - software_info.operating_platform = item[:operating_platform] if item[:operating_platform] | |
163 | - software_info.objectives = item[:objectives] if item[:objectives] | |
164 | - software_info.features = item[:features] if item[:features] | |
165 | - software_info.public_software = item[:public_software] == "true" if item[:public_software] | |
166 | - software_info.license_info = LicenseInfo.create :version=>"GPL - 1.0" | |
167 | - | |
168 | - if item[:software_language] | |
169 | - programming_language = ProgrammingLanguage.where(:name=>item[:software_language]).first | |
170 | - software_language = SoftwareLanguage.where(:programming_language_id=>programming_language).first | |
171 | - software_info.software_languages << software_language | |
172 | - end | |
173 | - | |
174 | - if item[:software_database] | |
175 | - database_description = DatabaseDescription.where(:name=>item[:software_database]).first | |
176 | - software_database = SoftwareDatabase.where(:database_description_id=>database_description).first | |
177 | - software_info.software_databases << software_database | |
178 | - end | |
179 | - | |
180 | - if item[:operating_system] | |
181 | - operating_system_name = OperatingSystemName.where(:name => item[:operating_system]).first | |
182 | - operating_system = OperatingSystem.where(:operating_system_name_id => operating_system_name).first | |
183 | - software_info.operating_systems << operating_system | |
184 | - end | |
185 | - | |
186 | - if item[:categories] | |
187 | - categories = item[:categories].split(",") | |
188 | - categories.map! {|category| category.strip} | |
189 | - | |
190 | - categories.each do |category_name| | |
191 | - category = Category.find_by_name category_name | |
192 | - community.categories << category | |
193 | - end | |
194 | - end | |
195 | - | |
196 | - if item[:owner] | |
197 | - owner = item[:owner] | |
198 | - community.add_admin Profile[owner] | |
199 | - end | |
200 | - | |
201 | - software_info.save! | |
202 | - end | |
203 | -end | |
204 | - | |
205 | -# Dynamic table steps | |
206 | -Given /^I fill in first "([^"]*)" class with "([^"]*)"$/ do |selector, value| | |
207 | - evaluate_script "jQuery('#{selector}').first().attr('value', '#{value}') && true" | |
208 | -end | |
209 | - | |
210 | -Given /^I fill in last "([^"]*)" class with "([^"]*)"$/ do |selector, value| | |
211 | - evaluate_script "jQuery('#{selector}').last().attr('value', '#{value}') && true" | |
212 | -end | |
213 | - | |
214 | -Given /^I click on the first button with class "([^"]*)"$/ do |selector| | |
215 | - evaluate_script "jQuery('#{selector}').first().trigger('click') && true" | |
216 | -end | |
217 | - | |
218 | -Given /^I click on the last button with class "([^"]*)"$/ do |selector| | |
219 | - evaluate_script "jQuery('#{selector}').last().trigger('click') && true" | |
220 | -end | |
221 | - | |
222 | -Given /^I click on anything with selector "([^"]*)"$/ do |selector| | |
223 | - page.evaluate_script("jQuery('##{selector}').click();") | |
224 | -end | |
225 | - | |
226 | -Given /^I should see "([^"]*)" of this selector "([^"]*)"$/ do |quantity, selector| | |
227 | - evaluate_script "jQuery('#{selector}').length == '#{quantity}'" | |
228 | -end | |
229 | - | |
230 | -Given /^selector "([^"]*)" should have any "([^"]*)"$/ do |selector, text| | |
231 | - evaluate_script "jQuery('#{selector}').html().indexOf('#{text}') != -1" | |
232 | -end | |
233 | - | |
234 | -Given /^I click on table number "([^"]*)" selector "([^"]*)" and select the value "([^"]*)"$/ do |number, selector, value| | |
235 | - evaluate_script "jQuery('#{selector}:nth-child(#{number}) select option:contains(\"#{value}\")').selected() && true" | |
236 | -end | |
237 | - | |
238 | -Given /^I fill with "([^"]*)" in field with name "([^"]*)" of table number "([^"]*)" with class "([^"]*)"$/ do |value, name, number, selector| | |
239 | - evaluate_script "jQuery('#{selector}:nth-child(#{number}) input[name=\"#{name}\"]').val('#{value}') && true" | |
240 | -end | |
241 | - | |
242 | -Given /^I sleep for (\d+) seconds$/ do |time| | |
243 | - sleep time.to_i | |
244 | -end | |
245 | - | |
246 | -Given /^I am logged in as mpog_admin$/ do | |
247 | - visit('/account/logout') | |
248 | - | |
249 | - user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') | |
250 | - person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" | |
251 | - user.person = person | |
252 | - user.save! | |
253 | - | |
254 | - user.activate | |
255 | - e = Environment.default | |
256 | - e.add_admin(user.person) | |
257 | - | |
258 | - visit('/account/login') | |
259 | - fill_in("Username", :with => user.login) | |
260 | - fill_in("Password", :with => '123456') | |
261 | - click_button("Log in") | |
262 | -end | |
263 | - | |
264 | -Given /^I should see "([^"]*)" before "([^"]*)"$/ do |before, after| | |
265 | - assert page.body.index("#{before}") < page.body.index("#{after}") | |
266 | -end | |
267 | - | |
268 | -Given /^I keyup on selector "([^"]*)"$/ do |selector| | |
269 | - selector_founded = evaluate_script("jQuery('#{selector}').trigger('keyup').length != 0") | |
270 | - selector_founded.should be_true | |
271 | -end | |
272 | - | |
273 | -Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| | |
274 | - should have_selector("div.#{klass}", :count => count) | |
275 | -end | |
276 | - | |
277 | -Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| | |
278 | - should have_field(field, :with => content) | |
279 | -end | |
280 | - | |
281 | -Given /^I should see "([^"]*)" in the page/ do |message| | |
282 | - assert_match message, page.body | |
283 | -end |