Skip to content

Commit

Permalink
Improve tests format
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Jan 5, 2017
1 parent b999eb9 commit 97a47e2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions test/response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1070,14 +1070,14 @@ class RubySamlTest < Minitest::Test
end

it "check what happens when trying retrieve attribute that does not exists" do
assert_equal nil, response_multiple_attr_values.attributes[:attribute_not_exists]
assert_equal nil, response_multiple_attr_values.attributes.single(:attribute_not_exists)
assert_equal nil, response_multiple_attr_values.attributes.multi(:attribute_not_exists)
assert_nil response_multiple_attr_values.attributes[:attribute_not_exists]
assert_nil response_multiple_attr_values.attributes.single(:attribute_not_exists)
assert_nil response_multiple_attr_values.attributes.multi(:attribute_not_exists)

OneLogin::RubySaml::Attributes.single_value_compatibility = false
assert_equal nil, response_multiple_attr_values.attributes[:attribute_not_exists]
assert_equal nil, response_multiple_attr_values.attributes.single(:attribute_not_exists)
assert_equal nil, response_multiple_attr_values.attributes.multi(:attribute_not_exists)
assert_nil response_multiple_attr_values.attributes[:attribute_not_exists]
assert_nil response_multiple_attr_values.attributes.single(:attribute_not_exists)
assert_nil response_multiple_attr_values.attributes.multi(:attribute_not_exists)
OneLogin::RubySaml::Attributes.single_value_compatibility = true
end

Expand Down
12 changes: 6 additions & 6 deletions test/settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ class SettingsTest < Minitest::Test
it "returns nil when the cert is an empty string" do
@settings = OneLogin::RubySaml::Settings.new
@settings.idp_cert = ""
assert_equal nil, @settings.get_idp_cert
assert_nil @settings.get_idp_cert
end

it "returns nil when the cert is nil" do
@settings = OneLogin::RubySaml::Settings.new
@settings.idp_cert = nil
assert_equal nil, @settings.get_idp_cert
assert_nil @settings.get_idp_cert
end

it "returns the certificate when it is valid" do
Expand All @@ -127,13 +127,13 @@ class SettingsTest < Minitest::Test
it "returns nil when the cert is an empty string" do
@settings = OneLogin::RubySaml::Settings.new
@settings.certificate = ""
assert_equal nil, @settings.get_sp_cert
assert_nil @settings.get_sp_cert
end

it "returns nil when the cert is nil" do
@settings = OneLogin::RubySaml::Settings.new
@settings.certificate = nil
assert_equal nil, @settings.get_sp_cert
assert_nil @settings.get_sp_cert
end

it "returns the certificate when it is valid" do
Expand All @@ -156,13 +156,13 @@ class SettingsTest < Minitest::Test
it "returns nil when the private key is an empty string" do
@settings = OneLogin::RubySaml::Settings.new
@settings.private_key = ""
assert_equal nil, @settings.get_sp_key
assert_nil @settings.get_sp_key
end

it "returns nil when the private key is nil" do
@settings = OneLogin::RubySaml::Settings.new
@settings.private_key = nil
assert_equal nil, @settings.get_sp_key
assert_nil @settings.get_sp_key
end

it "returns the private key when it is valid" do
Expand Down
2 changes: 1 addition & 1 deletion test/slo_logoutrequest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class RubySamlTest < Minitest::Test
describe "#not_on_or_after" do
it "extract the value of the NotOnOrAfter attribute" do
time_value = '2014-07-17T01:01:48Z'
assert_equal nil, logout_request.not_on_or_after
assert_nil logout_request.not_on_or_after
logout_request.document.root.attributes['NotOnOrAfter'] = time_value
assert_equal Time.parse(time_value), logout_request.not_on_or_after
end
Expand Down
4 changes: 2 additions & 2 deletions test/utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UtilsTest < Minitest::Test

it "returns nil when the cert is nil" do
cert = nil
assert_equal nil, OneLogin::RubySaml::Utils.format_cert(cert)
assert_nil OneLogin::RubySaml::Utils.format_cert(cert)
end

it "returns the certificate when it is valid" do
Expand Down Expand Up @@ -48,7 +48,7 @@ class UtilsTest < Minitest::Test

it "returns nil when the private key is nil" do
private_key = nil
assert_equal nil, OneLogin::RubySaml::Utils.format_private_key(private_key)
assert_nil OneLogin::RubySaml::Utils.format_private_key(private_key)
end

it "returns the private key when it is valid" do
Expand Down

0 comments on commit 97a47e2

Please sign in to comment.