Skip to content

Commit

Permalink
Refs #19576 - Avoid using assert_equal for nil (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
xprazak2 authored and ares committed May 22, 2017
1 parent df1c22c commit ab0909a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/unit/template_importer_test.rb
Expand Up @@ -186,6 +186,7 @@ def importer(opts = {})
setup_settings
imp = ForemanTemplates::TemplateImporter.new
imp.class.setting_overrides.each do |attribute|
next if assert_both_equal_nil imp.public_send(attribute), Setting["template_sync_#{attribute}".to_sym]
assert_equal imp.public_send(attribute), Setting["template_sync_#{attribute}".to_sym]
end
end
Expand Down Expand Up @@ -259,5 +260,15 @@ def setup_settings(opts = {})
FactoryGirl.create(:setting, :settings_type => "boolean", :category => category, :name => 'template_sync_negate', :default => false)
FactoryGirl.create(:setting, :settings_type => "string", :category => category, :name => 'template_sync_branch', :default => default_branch)
end

def assert_both_equal_nil(expected, actual)
if expected.nil? || actual.nil?
assert_nil expected
assert_nil actual
true
else
false
end
end
end
end

0 comments on commit ab0909a

Please sign in to comment.