Commit 0f263193bedd00378b03d90a590f680dfb9ba1e6

Authored by Braulio Bhavamitra
1 parent dc161eb7

rspec3: migrate be_true and be_false

features/step_definitions/activate_enterprise_steps.rb
... ... @@ -5,7 +5,7 @@ Given /^I fill in "([^\"]*)" with code of "([^\"]*)"$/ do |field, enterprise|
5 5 end
6 6  
7 7 Given /^enterprise "([^\"]*)" should be enabled$/ do |enterprise|
8   - Enterprise.find_by_name(enterprise).enabled?.should be_true
  8 + Enterprise.find_by_name(enterprise).enabled?.should be_truthy
9 9 end
10 10  
11 11 Given /^"([^\"]*)" is the active enterprise template$/ do |enterprise|
... ... @@ -26,34 +26,34 @@ end
26 26 Given /^"([^\"]*)" has "([^\"]*)" as template$/ do |ent, templ|
27 27 template = Enterprise.find_by_name(templ)
28 28 enterprise = Enterprise.find_by_name(ent)
29   - (template.boxes.size == enterprise.boxes.size).should be_true
30   - (template.layout_template == enterprise.layout_template).should be_true
31   - (template.theme == enterprise.theme).should be_true
32   - (template.custom_header == enterprise.custom_header).should be_true
33   - (template.custom_footer == enterprise.custom_footer).should be_true
  29 + (template.boxes.size == enterprise.boxes.size).should be_truthy
  30 + (template.layout_template == enterprise.layout_template).should be_truthy
  31 + (template.theme == enterprise.theme).should be_truthy
  32 + (template.custom_header == enterprise.custom_header).should be_truthy
  33 + (template.custom_footer == enterprise.custom_footer).should be_truthy
34 34 end
35 35  
36 36 Given /^"([^\"]*)" doesnt have "([^\"]*)" as template$/ do |ent, templ|
37 37 template = Enterprise.find_by_name(templ)
38 38 enterprise = Enterprise.find_by_name(ent)
39   - (template.boxes.size == enterprise.boxes.size).should be_false
40   - (template.layout_template == enterprise.layout_template).should be_false
41   - (template.theme == enterprise.theme).should be_false
42   - (template.custom_header == enterprise.custom_header).should be_false
43   - (template.custom_footer == enterprise.custom_footer).should be_false
  39 + (template.boxes.size == enterprise.boxes.size).should be_falsey
  40 + (template.layout_template == enterprise.layout_template).should be_falsey
  41 + (template.theme == enterprise.theme).should be_falsey
  42 + (template.custom_header == enterprise.custom_header).should be_falsey
  43 + (template.custom_footer == enterprise.custom_footer).should be_falsey
44 44 end
45 45  
46 46 Given /^enterprise "([^\"]*)" is enabled$/ do |enterprise|
47 47 Enterprise.find_by_name(enterprise).update_attribute(:enabled,true)
48   - Enterprise.find_by_name(enterprise).enabled?.should be_true
  48 + Enterprise.find_by_name(enterprise).enabled?.should be_truthy
49 49 end
50 50  
51 51 Given /^enterprise "([^\"]*)" should be blocked$/ do |enterprise|
52   - Enterprise.find_by_name(enterprise).blocked?.should be_true
  52 + Enterprise.find_by_name(enterprise).blocked?.should be_truthy
53 53 end
54 54  
55 55 Given /^enterprise "([^\"]*)" should not be blocked$/ do |enterprise|
56   - Enterprise.find_by_name(enterprise).blocked?.should_not be_true
  56 + Enterprise.find_by_name(enterprise).blocked?.should_not be_truthy
57 57 end
58 58  
59 59 Given /^enterprise template must be replaced after enable$/ do
... ...
features/step_definitions/custom_web_steps.rb
... ... @@ -24,12 +24,12 @@ end
24 24  
25 25 Then /^the "([^"]*)" button should be disabled$/ do |selector|
26 26 field = find(selector)
27   - field['disabled'].should be_true
  27 + field['disabled'].should be_truthy
28 28 end
29 29  
30 30 Then /^the "([^"]*)" button should be enabled$/ do |selector|
31 31 field = find(selector)
32   - field['disabled'].should_not be_true
  32 + field['disabled'].should_not be_truthy
33 33 end
34 34  
35 35 When /^I reload and wait for the page$/ do
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -534,7 +534,7 @@ end
534 534  
535 535 Then /^I should receive an e-mail on (.*)$/ do |address|
536 536 last_mail = ActionMailer::Base.deliveries.last
537   - last_mail.nil?.should be_false
  537 + last_mail.nil?.should be_falsey
538 538 last_mail['to'].to_s.should == address
539 539 end
540 540  
... ... @@ -545,16 +545,16 @@ end
545 545  
546 546 Then /^there should be an? (.+) named "([^\"]*)"$/ do |klass_name, profile_name|
547 547 klass = klass_name.camelize.constantize
548   - klass.find_by_name(profile_name).nil?.should be_false
  548 + klass.find_by_name(profile_name).nil?.should be_falsey
549 549 end
550 550  
551 551 Then /^"([^\"]*)" profile should exist$/ do |profile_selector|
552 552 profile = nil
553 553 begin
554 554 profile = Profile.find_by_name(profile_selector)
555   - profile.nil?.should be_false
  555 + profile.nil?.should be_falsey
556 556 rescue
557   - profile.nil?.should be_false
  557 + profile.nil?.should be_falsey
558 558 end
559 559 end
560 560  
... ... @@ -562,9 +562,9 @@ Then /^"([^\"]*)" profile should not exist$/ do |profile_selector|
562 562 profile = nil
563 563 begin
564 564 profile = Profile.find_by_name(profile_selector)
565   - profile.nil?.should be_true
  565 + profile.nil?.should be_truthy
566 566 rescue
567   - profile.nil?.should be_true
  567 + profile.nil?.should be_truthy
568 568 end
569 569 end
570 570  
... ...
features/step_definitions/web_steps.rb
... ... @@ -203,7 +203,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |labe
203 203 with_scope(selector) do
204 204 field_checked = find_field(label)['checked']
205 205 if field_checked.respond_to? :should
206   - field_checked.should be_true
  206 + field_checked.should be_truthy
207 207 else
208 208 assert field_checked
209 209 end
... ... @@ -214,7 +214,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
214 214 with_scope(selector) do
215 215 field_checked = find_field(label)['checked']
216 216 if field_checked.respond_to? :should
217   - field_checked.should be_false
  217 + field_checked.should be_falsey
218 218 else
219 219 assert !field_checked
220 220 end
... ...