[Git][noosfero/noosfero][master] rspec3: migrate be_true and be_false
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Sat Nov 21 10:49:28 BRST 2015
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
0f263193 by Braulio Bhavamitra at 2015-11-21T09:48:24Z
rspec3: migrate be_true and be_false
- - - - -
4 changed files:
- features/step_definitions/activate_enterprise_steps.rb
- features/step_definitions/custom_web_steps.rb
- features/step_definitions/noosfero_steps.rb
- features/step_definitions/web_steps.rb
Changes:
=====================================
features/step_definitions/activate_enterprise_steps.rb
=====================================
--- a/features/step_definitions/activate_enterprise_steps.rb
+++ b/features/step_definitions/activate_enterprise_steps.rb
@@ -5,7 +5,7 @@ Given /^I fill in "([^\"]*)" with code of "([^\"]*)"$/ do |field, enterprise|
end
Given /^enterprise "([^\"]*)" should be enabled$/ do |enterprise|
- Enterprise.find_by_name(enterprise).enabled?.should be_true
+ Enterprise.find_by_name(enterprise).enabled?.should be_truthy
end
Given /^"([^\"]*)" is the active enterprise template$/ do |enterprise|
@@ -26,34 +26,34 @@ end
Given /^"([^\"]*)" has "([^\"]*)" as template$/ do |ent, templ|
template = Enterprise.find_by_name(templ)
enterprise = Enterprise.find_by_name(ent)
- (template.boxes.size == enterprise.boxes.size).should be_true
- (template.layout_template == enterprise.layout_template).should be_true
- (template.theme == enterprise.theme).should be_true
- (template.custom_header == enterprise.custom_header).should be_true
- (template.custom_footer == enterprise.custom_footer).should be_true
+ (template.boxes.size == enterprise.boxes.size).should be_truthy
+ (template.layout_template == enterprise.layout_template).should be_truthy
+ (template.theme == enterprise.theme).should be_truthy
+ (template.custom_header == enterprise.custom_header).should be_truthy
+ (template.custom_footer == enterprise.custom_footer).should be_truthy
end
Given /^"([^\"]*)" doesnt have "([^\"]*)" as template$/ do |ent, templ|
template = Enterprise.find_by_name(templ)
enterprise = Enterprise.find_by_name(ent)
- (template.boxes.size == enterprise.boxes.size).should be_false
- (template.layout_template == enterprise.layout_template).should be_false
- (template.theme == enterprise.theme).should be_false
- (template.custom_header == enterprise.custom_header).should be_false
- (template.custom_footer == enterprise.custom_footer).should be_false
+ (template.boxes.size == enterprise.boxes.size).should be_falsey
+ (template.layout_template == enterprise.layout_template).should be_falsey
+ (template.theme == enterprise.theme).should be_falsey
+ (template.custom_header == enterprise.custom_header).should be_falsey
+ (template.custom_footer == enterprise.custom_footer).should be_falsey
end
Given /^enterprise "([^\"]*)" is enabled$/ do |enterprise|
Enterprise.find_by_name(enterprise).update_attribute(:enabled,true)
- Enterprise.find_by_name(enterprise).enabled?.should be_true
+ Enterprise.find_by_name(enterprise).enabled?.should be_truthy
end
Given /^enterprise "([^\"]*)" should be blocked$/ do |enterprise|
- Enterprise.find_by_name(enterprise).blocked?.should be_true
+ Enterprise.find_by_name(enterprise).blocked?.should be_truthy
end
Given /^enterprise "([^\"]*)" should not be blocked$/ do |enterprise|
- Enterprise.find_by_name(enterprise).blocked?.should_not be_true
+ Enterprise.find_by_name(enterprise).blocked?.should_not be_truthy
end
Given /^enterprise template must be replaced after enable$/ do
=====================================
features/step_definitions/custom_web_steps.rb
=====================================
--- a/features/step_definitions/custom_web_steps.rb
+++ b/features/step_definitions/custom_web_steps.rb
@@ -24,12 +24,12 @@ end
Then /^the "([^"]*)" button should be disabled$/ do |selector|
field = find(selector)
- field['disabled'].should be_true
+ field['disabled'].should be_truthy
end
Then /^the "([^"]*)" button should be enabled$/ do |selector|
field = find(selector)
- field['disabled'].should_not be_true
+ field['disabled'].should_not be_truthy
end
When /^I reload and wait for the page$/ do
=====================================
features/step_definitions/noosfero_steps.rb
=====================================
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -534,7 +534,7 @@ end
Then /^I should receive an e-mail on (.*)$/ do |address|
last_mail = ActionMailer::Base.deliveries.last
- last_mail.nil?.should be_false
+ last_mail.nil?.should be_falsey
last_mail['to'].to_s.should == address
end
@@ -545,16 +545,16 @@ end
Then /^there should be an? (.+) named "([^\"]*)"$/ do |klass_name, profile_name|
klass = klass_name.camelize.constantize
- klass.find_by_name(profile_name).nil?.should be_false
+ klass.find_by_name(profile_name).nil?.should be_falsey
end
Then /^"([^\"]*)" profile should exist$/ do |profile_selector|
profile = nil
begin
profile = Profile.find_by_name(profile_selector)
- profile.nil?.should be_false
+ profile.nil?.should be_falsey
rescue
- profile.nil?.should be_false
+ profile.nil?.should be_falsey
end
end
@@ -562,9 +562,9 @@ Then /^"([^\"]*)" profile should not exist$/ do |profile_selector|
profile = nil
begin
profile = Profile.find_by_name(profile_selector)
- profile.nil?.should be_true
+ profile.nil?.should be_truthy
rescue
- profile.nil?.should be_true
+ profile.nil?.should be_truthy
end
end
=====================================
features/step_definitions/web_steps.rb
=====================================
--- a/features/step_definitions/web_steps.rb
+++ b/features/step_definitions/web_steps.rb
@@ -203,7 +203,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |labe
with_scope(selector) do
field_checked = find_field(label)['checked']
if field_checked.respond_to? :should
- field_checked.should be_true
+ field_checked.should be_truthy
else
assert field_checked
end
@@ -214,7 +214,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
with_scope(selector) do
field_checked = find_field(label)['checked']
if field_checked.respond_to? :should
- field_checked.should be_false
+ field_checked.should be_falsey
else
assert !field_checked
end
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/0f263193bedd00378b03d90a590f680dfb9ba1e6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151121/52341451/attachment-0001.html>
More information about the Noosfero-dev
mailing list