33# require 'shared_examples/controller_oauth_shared_examples'
44
55def stub_all_oauth_requests!
6- consumer = OAuth ::Consumer . new ( 'key' , 'secret' , site : 'http://myapi .com' )
6+ consumer = OAuth ::Consumer . new ( 'key' , 'secret' , site : 'http://api.example .com' )
77 req_token = OAuth ::RequestToken . new ( consumer )
88 acc_token = OAuth ::AccessToken . new ( consumer )
99
1010 response = Object . new
1111 def response . body
1212 {
1313 'following' => false , 'listed_count' => 0 , 'profile_link_color' => '0084B4' ,
14- 'profile_image_url' => 'http://a1.twimg .com/profile_images/536178575/noamb_normal.jpg' ,
14+ 'profile_image_url' => 'http://media.example .com/profile_images/536178575/noamb_normal.jpg' ,
1515 'description' => 'Programmer/Heavy Metal Fan/New Father' ,
1616 'status' => {
1717 'text' => 'coming soon to sorcery gem: twitter and facebook authentication support.' ,
@@ -27,7 +27,7 @@ def response.body
2727 'screen_name' => 'nbenari' , 'profile_use_background_image' => true , 'location' => 'Israel' ,
2828 'statuses_count' => 25 , 'profile_background_color' => '022330' , 'lang' => 'en' ,
2929 'verified' => false , 'notifications' => false ,
30- 'profile_background_image_url' => 'http://a3.twimg .com/profile_background_images/104087198/04042010339.jpg' ,
30+ 'profile_background_image_url' => 'http://media.example .com/profile_background_images/104087198/04042010339.jpg' ,
3131 'favourites_count' => 5 , 'created_at' => 'Fri Nov 20 21:58:19 +0000 2009' ,
3232 'is_translator' => false , 'contributors_enabled' => false , 'protected' => false ,
3333 'follow_request_sent' => false , 'time_zone' => 'Greenland' , 'profile_text_color' => '333333' ,
@@ -54,14 +54,14 @@ def response.body
5454 sorcery_controller_property_set ( :external_providers , %i[ twitter jira ] )
5555 sorcery_controller_external_property_set ( :twitter , :key , 'eYVNBjBDi33aa9GkA3w' )
5656 sorcery_controller_external_property_set ( :twitter , :secret , 'XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8' )
57- sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://blabla .com' )
57+ sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://example .com' )
5858
5959 sorcery_controller_external_property_set ( :jira , :key , '7810b8e317ebdc81601c72f8daecc0f1' )
6060 sorcery_controller_external_property_set ( :jira , :secret , 'MyAppUsingJira' )
61- sorcery_controller_external_property_set ( :jira , :site , 'http://jira.mycompany .com/plugins/servlet/oauth' )
61+ sorcery_controller_external_property_set ( :jira , :site , 'http://jira.example .com/plugins/servlet/oauth' )
6262 sorcery_controller_external_property_set ( :jira , :signature_method , 'RSA-SHA1' )
6363 sorcery_controller_external_property_set ( :jira , :private_key_file , 'myrsakey.pem' )
64- sorcery_controller_external_property_set ( :jira , :callback_url , 'http://myappusingjira .com/home' )
64+ sorcery_controller_external_property_set ( :jira , :callback_url , 'http://app.example .com/home' )
6565 end
6666
6767 # ----------------- OAuth -----------------------
@@ -71,7 +71,7 @@ def response.body
7171 end
7272
7373 after do
74- sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://blabla .com' )
74+ sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://example .com' )
7575 sorcery_controller_external_property_set ( :twitter , :original_callback_url , nil )
7676 end
7777
@@ -83,19 +83,19 @@ def response.body
8383 it 'login_at redirects correctly' do
8484 get :login_at_test
8585 expect ( response ) . to be_a_redirect
86- expect ( response ) . to redirect_to ( 'http://myapi .com/oauth/authorize?oauth_callback=http%3A%2F%2Ftest.host%2Foauth%2Ftwitter%2Fcallback&oauth_token=' )
86+ expect ( response ) . to redirect_to ( 'http://api.example .com/oauth/authorize?oauth_callback=http%3A%2F%2Ftest.host%2Foauth%2Ftwitter%2Fcallback&oauth_token=' )
8787 end
8888 end
8989
9090 context 'when callback_url begins with http://' do
9191 before do
92- sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://blabla .com/oauth/twitter/callback' )
92+ sorcery_controller_external_property_set ( :twitter , :callback_url , 'http://example .com/oauth/twitter/callback' )
9393 end
9494
9595 it 'login_at redirects correctly' do
9696 get :login_at_test
9797 expect ( response ) . to be_a_redirect
98- expect ( response ) . to redirect_to ( 'http://myapi. com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla .com%2Foauth%2Ftwitter%2Fcallback&oauth_token=' )
98+ expect ( response ) . to redirect_to ( 'http://api.example. com/oauth/authorize?oauth_callback=http%3A%2F%2Fexample .com%2Foauth%2Ftwitter%2Fcallback&oauth_token=' )
9999 end
100100 end
101101
@@ -163,7 +163,7 @@ def response.body
163163 sorcery_model_property_set ( :authentications_class , UserProvider )
164164
165165 allow ( user ) . to receive_message_chain ( :sorcery_config , :username_attribute_names , :first ) { :username }
166- allow ( user ) . to receive ( :username ) . and_return ( 'bla@bla .com' )
166+ allow ( user ) . to receive ( :username ) . and_return ( 'bla@example .com' )
167167 login_user ( user )
168168
169169 expect ( user ) . to receive ( :add_provider_to_user ) . with ( 'twitter' , '123' )
0 commit comments