test/utils_test.rb in ruby-saml-1.5.0 vs test/utils_test.rb in ruby-saml-1.6.0

- old
+ new

@@ -1,12 +1,11 @@ require File.expand_path(File.join(File.dirname(__FILE__), "test_helper")) class UtilsTest < Minitest::Test describe ".format_cert" do - let(:formatted_certificate) do - read_certificate("formatted_certificate") - end + let(:formatted_certificate) {read_certificate("formatted_certificate")} + let(:formatted_chained_certificate) {read_certificate("formatted_chained_certificate")} it "returns empty string when the cert is an empty string" do cert = "" assert_equal "", OneLogin::RubySaml::Utils.format_cert(cert) end @@ -32,10 +31,20 @@ it "reformats the certificate when there line breaks and no headers" do invalid_certificate3 = read_certificate("invalid_certificate3") assert_equal formatted_certificate, OneLogin::RubySaml::Utils.format_cert(invalid_certificate3) end + + it "returns the chained certificate when it is a valid chained certificate" do + assert_equal formatted_chained_certificate, OneLogin::RubySaml::Utils.format_cert(formatted_chained_certificate) + end + + it "reformats the chained certificate when there are spaces and no line breaks" do + invalid_chained_certificate1 = read_certificate("invalid_chained_certificate1") + assert_equal formatted_chained_certificate, OneLogin::RubySaml::Utils.format_cert(invalid_chained_certificate1) + end + end describe ".format_private_key" do let(:formatted_private_key) do read_certificate("formatted_private_key") @@ -136,10 +145,10 @@ assert_equal = "The status code of the Logout Response was not Success, was Requester -> The request could not be performed due to an error on the part of the requester.", status_error_msg status_error_msg2 = OneLogin::RubySaml::Utils.status_error_msg(error_msg, status_code) assert_equal = "The status code of the Logout Response was not Success, was Requester", status_error_msg2 - status_error_msg3 = OneLogin::RubySaml::Utils.status_error_msg(error_msg) + status_error_msg3 = OneLogin::RubySaml::Utils.status_error_msg(error_msg) assert_equal = "The status code of the Logout Response was not Success", status_error_msg3 end end describe "Utils" do