66 def app
77 strat = OmniAuth ::Strategies ::OpenID
88 Rack ::Builder . new {
9- use Rack ::Session ::Cookie
9+ use Rack ::Session ::Cookie , secret : 'foobar'
1010 use strat
1111 run lambda { |env | [ 404 , { 'Content-Type' => 'text/plain' } , [ nil || env . key? ( 'omniauth.auth' ) . to_s ] ] }
1212 } . to_app
@@ -22,55 +22,55 @@ def expired_query_string
2222 end
2323
2424 it 'should respond with OK' do
25- last_response . should be_ok
25+ expect ( last_response ) . to be_ok
2626 end
2727
2828 it 'should respond with HTML' do
29- last_response . content_type . should == 'text/html'
29+ expect ( last_response . content_type ) . to eq 'text/html'
3030 end
3131
3232 it 'should render an identifier URL input' do
33- last_response . body . should =~ %r{<input[^>]*openid_url}
33+ expect ( last_response . body ) . to match %r{<input[^>]*openid_url}
3434 end
3535 end
3636
37- #describe '/auth/open_id with an identifier URL' do
38- # context 'successful' do
39- # before do
40- # @identifier_url = 'http://me.example.org'
41- # # TODO: change this mock to actually return some sort of OpenID response
42- # stub_request(:get, @identifier_url)
43- # get '/auth/open_id?openid_url=' + @identifier_url
44- # end
45- #
46- # it 'should redirect to the OpenID identity URL' do
47- # last_response.should be_redirect
48- # last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*}
49- # end
50- #
51- # it 'should tell the OpenID server to return to the callback URL' do
52- # return_to = CGI.escape(last_request.url + '/callback')
53- # last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}}
54- # end
55- # end
56- #end
37+ # describe '/auth/open_id with an identifier URL' do
38+ # context 'successful' do
39+ # before do
40+ # @identifier_url = 'http://me.example.org'
41+ # # TODO: change this mock to actually return some sort of OpenID response
42+ # stub_request(:get, @identifier_url)
43+ # get '/auth/open_id?openid_url=' + @identifier_url
44+ # end
45+ #
46+ # it 'should redirect to the OpenID identity URL' do
47+ # last_response.should be_redirect
48+ # last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*}
49+ # end
50+ #
51+ # it 'should tell the OpenID server to return to the callback URL' do
52+ # return_to = CGI.escape(last_request.url + '/callback')
53+ # last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}}
54+ # end
55+ # end
56+ # end
5757
5858 describe 'followed by /auth/open_id/callback' do
5959 context 'successful' do
60- #before do
61- # @identifier_url = 'http://me.example.org'
62- # # TODO: change this mock to actually return some sort of OpenID response
63- # stub_request(:get, @identifier_url)
64- # get '/auth/open_id/callback'
65- #end
60+ # before do
61+ # @identifier_url = 'http://me.example.org'
62+ # # TODO: change this mock to actually return some sort of OpenID response
63+ # stub_request(:get, @identifier_url)
64+ # get '/auth/open_id/callback'
65+ # end
6666
6767 it "should set provider to open_id"
6868 it "should create auth_hash based on sreg"
6969 it "should create auth_hash based on ax"
7070
71- #it 'should call through to the master app' do
72- # last_response.body.should == 'true'
73- #end
71+ # it 'should call through to the master app' do
72+ # last_response.body.should == 'true'
73+ # end
7474 end
7575
7676 context 'unsuccessful' do
@@ -81,11 +81,10 @@ def expired_query_string
8181
8282 it 'it should redirect to invalid credentials' do
8383 pending
84- last_response . should be_redirect
85- last_response . headers [ 'Location' ] . should =~ %r{invalid_credentials}
84+ expect ( last_response ) . to be_redirect
85+ expect ( last_response ) . to match %r{invalid_credentials}
8686 end
8787 end
8888 end
8989 end
90-
9190end
0 commit comments