@@ -132,6 +132,34 @@ class MetadataTest < Minitest::Test
132
132
end
133
133
end
134
134
135
+ describe "when attribute service is configured with multiple attribute values" do
136
+ let ( :attr_svc ) { REXML ::XPath . first ( xml_doc , "//md:AttributeConsumingService" ) }
137
+ let ( :req_attr ) { REXML ::XPath . first ( xml_doc , "//md:RequestedAttribute" ) }
138
+
139
+ before do
140
+ settings . attribute_consuming_service . configure do
141
+ service_name "Test Service"
142
+ add_attribute ( :name => "Name" , :name_format => "Name Format" , :friendly_name => "Friendly Name" , :attribute_value => [ "Attribute Value One" , "Attribute Value Two" ] )
143
+ end
144
+ end
145
+
146
+ it "generates attribute service" do
147
+ assert_equal "true" , attr_svc . attribute ( "isDefault" ) . value
148
+ assert_equal "1" , attr_svc . attribute ( "index" ) . value
149
+ assert_equal REXML ::XPath . first ( xml_doc , "//md:ServiceName" ) . text . strip , "Test Service"
150
+
151
+ assert_equal "Name" , req_attr . attribute ( "Name" ) . value
152
+ assert_equal "Name Format" , req_attr . attribute ( "NameFormat" ) . value
153
+ assert_equal "Friendly Name" , req_attr . attribute ( "FriendlyName" ) . value
154
+
155
+ attribute_values = REXML ::XPath . match ( xml_doc , "//saml:AttributeValue" ) . map ( &:text )
156
+ assert_equal "Attribute Value One" , attribute_values [ 0 ]
157
+ assert_equal "Attribute Value Two" , attribute_values [ 1 ]
158
+
159
+ assert validate_xml! ( xml_text , "saml-schema-metadata-2.0.xsd" )
160
+ end
161
+ end
162
+
135
163
describe "when attribute service is configured" do
136
164
let ( :attr_svc ) { REXML ::XPath . first ( xml_doc , "//md:AttributeConsumingService" ) }
137
165
let ( :req_attr ) { REXML ::XPath . first ( xml_doc , "//md:RequestedAttribute" ) }
0 commit comments