@@ -39,11 +39,11 @@ def post_xml(xml=:example_response)
39
39
end
40
40
41
41
it 'should get authentication page' do
42
- last_response . should be_redirect
43
- last_response . location . should match /https:\/ \/ idp.sso.example.com\/ signon\/ 29490/
44
- last_response . location . should match /\? SAMLRequest=/
45
- last_response . location . should_not match /mapped_param_key/
46
- last_response . location . should_not match /original_param_key/
42
+ expect ( last_response ) . to be_redirect
43
+ expect ( last_response . location ) . to match /https:\/ \/ idp.sso.example.com\/ signon\/ 29490/
44
+ expect ( last_response . location ) . to match /\? SAMLRequest=/
45
+ expect ( last_response . location ) . not_to match /mapped_param_key/
46
+ expect ( last_response . location ) . not_to match /original_param_key/
47
47
end
48
48
end
49
49
@@ -53,11 +53,11 @@ def post_xml(xml=:example_response)
53
53
end
54
54
55
55
it 'should get authentication page' do
56
- last_response . should be_redirect
57
- last_response . location . should match /https:\/ \/ idp.sso.example.com\/ signon\/ 29490/
58
- last_response . location . should match /\? SAMLRequest=/
59
- last_response . location . should match /\& mapped_param_key=original_param_value/
60
- last_response . location . should_not match /original_param_key/
56
+ expect ( last_response ) . to be_redirect
57
+ expect ( last_response . location ) . to match /https:\/ \/ idp.sso.example.com\/ signon\/ 29490/
58
+ expect ( last_response . location ) . to match /\? SAMLRequest=/
59
+ expect ( last_response . location ) . to match /\& mapped_param_key=original_param_value/
60
+ expect ( last_response . location ) . not_to match /original_param_key/
61
61
end
62
62
end
63
63
@@ -71,17 +71,17 @@ def post_xml(xml=:example_response)
71
71
%w( foo.example.com bar.example.com ) . each do |host |
72
72
get "https://#{ host } /auth/saml"
73
73
74
- last_response . should be_redirect
74
+ expect ( last_response ) . to be_redirect
75
75
76
76
location = URI . parse ( last_response . location )
77
77
query = Rack ::Utils . parse_query location . query
78
- query . should have_key ( 'SAMLRequest' )
78
+ expect ( query ) . to have_key ( 'SAMLRequest' )
79
79
80
80
request = REXML ::Document . new ( Base64 . decode64 ( query [ 'SAMLRequest' ] ) )
81
- request . root . should_not be_nil
81
+ expect ( request . root ) . not_to be_nil
82
82
83
83
acs = request . root . attributes . get_attribute ( 'AssertionConsumerServiceURL' )
84
- acs . to_s . should == "https://#{ host } /auth/saml/callback"
84
+ expect ( acs . to_s ) . to eq "https://#{ host } /auth/saml/callback"
85
85
end
86
86
end
87
87
end
@@ -93,7 +93,7 @@ def post_xml(xml=:example_response)
93
93
let ( :xml ) { :example_response }
94
94
95
95
before :each do
96
- Time . stub ( :now ) . and_return ( Time . utc ( 2012 , 11 , 8 , 20 , 40 , 00 ) )
96
+ allow ( Time ) . to receive ( :now ) . and_return ( Time . utc ( 2012 , 11 , 8 , 20 , 40 , 00 ) )
97
97
end
98
98
99
99
context "when the response is valid" do
@@ -102,21 +102,21 @@ def post_xml(xml=:example_response)
102
102
end
103
103
104
104
it "should set the uid to the nameID in the SAML response" do
105
- auth_hash [ 'uid' ] . should == '_1f6fcf6be5e13b08b1e3610e7ff59f205fbd814f23'
105
+ expect ( auth_hash [ 'uid' ] ) . to eq '_1f6fcf6be5e13b08b1e3610e7ff59f205fbd814f23'
106
106
end
107
107
108
108
it "should set the raw info to all attributes" do
109
- auth_hash [ 'extra' ] [ 'raw_info' ] . all . to_hash . should == {
109
+ expect ( auth_hash [ 'extra' ] [ 'raw_info' ] . all . to_hash ) . to eq (
110
110
'first_name' => [ 'Rajiv' ] ,
111
111
'last_name' => [ 'Manglani' ] ,
112
112
'email' => [ 'user@example.com' ] ,
113
113
'company_name' => [ 'Example Company' ] ,
114
114
'fingerprint' => saml_options [ :idp_cert_fingerprint ]
115
- }
115
+ )
116
116
end
117
117
118
118
it "should set the response_object to the response object from ruby_saml response" do
119
- auth_hash [ 'extra' ] [ 'response_object' ] . should be_kind_of ( OneLogin ::RubySaml ::Response )
119
+ expect ( auth_hash [ 'extra' ] [ 'response_object' ] ) . to be_kind_of ( OneLogin ::RubySaml ::Response )
120
120
end
121
121
end
122
122
@@ -128,17 +128,17 @@ def post_xml(xml=:example_response)
128
128
end
129
129
130
130
it "should set the uid to the nameID in the SAML response" do
131
- auth_hash [ 'uid' ] . should == '_1f6fcf6be5e13b08b1e3610e7ff59f205fbd814f23'
131
+ expect ( auth_hash [ 'uid' ] ) . to eq '_1f6fcf6be5e13b08b1e3610e7ff59f205fbd814f23'
132
132
end
133
133
134
134
it "should set the raw info to all attributes" do
135
- auth_hash [ 'extra' ] [ 'raw_info' ] . all . to_hash . should == {
135
+ expect ( auth_hash [ 'extra' ] [ 'raw_info' ] . all . to_hash ) . to eq (
136
136
'first_name' => [ 'Rajiv' ] ,
137
137
'last_name' => [ 'Manglani' ] ,
138
138
'email' => [ 'user@example.com' ] ,
139
139
'company_name' => [ 'Example Company' ] ,
140
140
'fingerprint' => 'C1:59:74:2B:E8:0C:6C:A9:41:0F:6E:83:F6:D1:52:25:45:58:89:FB'
141
- }
141
+ )
142
142
end
143
143
end
144
144
@@ -195,12 +195,12 @@ def post_xml(xml=:example_response)
195
195
end
196
196
197
197
it "should obey attribute statements mapping" do
198
- auth_hash [ :info ] . should == {
198
+ expect ( auth_hash [ :info ] ) . to eq (
199
199
'first_name' => 'Rajiv' ,
200
200
'last_name' => 'Manglani' ,
201
201
'email' => 'user@example.com' ,
202
202
'name' => nil
203
- }
203
+ )
204
204
end
205
205
end
206
206
end
@@ -211,15 +211,15 @@ def post_xml(xml=:example_response)
211
211
end
212
212
213
213
it 'should get SP metadata page' do
214
- last_response . status . should == 200
215
- last_response . header [ "Content-Type" ] . should == "application/xml"
214
+ expect ( last_response . status ) . to eq 200
215
+ expect ( last_response . header [ "Content-Type" ] ) . to eq "application/xml"
216
216
end
217
217
218
218
it 'should configure attributes consuming service' do
219
- last_response . body . should match /AttributeConsumingService/
220
- last_response . body . should match /first_name/
221
- last_response . body . should match /last_name/
222
- last_response . body . should match /Required attributes/
219
+ expect ( last_response . body ) . to match /AttributeConsumingService/
220
+ expect ( last_response . body ) . to match /first_name/
221
+ expect ( last_response . body ) . to match /last_name/
222
+ expect ( last_response . body ) . to match /Required attributes/
223
223
end
224
224
end
225
225
0 commit comments