Rspec test failure about relative url


(Woong Bin Song) #1

Hello I’ve got trouble about discourse settings.

discourse version is 1.6.1 and I Have Some Question.

File : config/discourse_defaults.conf

# set to relative URL (for subdirectory hosting)
# IMPORTANT: path must not include a trailing /
# EG: /forum
relative_url_root = /

when I make it ‘/’(root), rspec test passed all cases. But When I change it ‘/url’, rspec test failed 81 cases.
I checked some test code in spec folder, some test case’s expected value is hard coded and the other is not.

This is my question.
If I fix relative_url_root on setting, Is there any other setting which I must change? or Should I fix the Test Code?

Here’s the Failure list.

Failed examples:

rspec ./spec/components/topic_query_spec.rb:90 # TopicQuery category filter returns topics in the category when we filter to it
rspec ./spec/models/post_spec.rb:363 # Post maximum links returns 0 links for a post with mentions
rspec ./spec/models/post_spec.rb:248 # Post maximum attachments finds attachments from HTML
rspec ./spec/models/post_spec.rb:267 # Post maximum attachments validation newuser doesn't allow a new user to edit their post to insert an attachment
rspec ./spec/models/post_spec.rb:263 # Post maximum attachments validation newuser doesn't allow more than the maximum
rspec ./spec/controllers/session_controller_spec.rb:395 # SessionController.sso_provider successfully logs in and redirects user to return_sso_url when the user is not logged in
rspec ./spec/controllers/session_controller_spec.rb:155 # SessionController.sso_login redirects to root if the host of the return_path is different
rspec ./spec/controllers/session_controller_spec.rb:144 # SessionController.sso_login redirects to root if the host of the return_path is different
rspec ./spec/controllers/session_controller_spec.rb:54 # SessionController.sso_login can take over an account
rspec ./spec/controllers/session_controller_spec.rb:133 # SessionController.sso_login redirects to a non-relative url
rspec ./spec/controllers/session_controller_spec.rb:283 # SessionController.sso_login can act as an SSO provider successfully logs in and redirects user to return_sso_url when the user is not logged in
rspec ./spec/models/topic_link_spec.rb:87 # TopicLink internal links topic link works
rspec ./spec/models/topic_link_spec.rb:252 # TopicLink internal link with non-standard port includes the non standard port if present
rspec ./spec/models/topic_link_spec.rb:343 # TopicLink query methods .duplicate_lookup should return the right response
rspec ./spec/models/topic_link_spec.rb:311 # TopicLink query methods with data secures internal links correctly
rspec ./spec/controllers/static_controller_spec.rb:93 # StaticController#enter with a period to force a new host redirects to the root path
rspec ./spec/controllers/static_controller_spec.rb:72 # StaticController#enter without a redirect path redirects to the root url
rspec ./spec/controllers/static_controller_spec.rb:100 # StaticController#enter with a full url to someone else redirects to the root path
rspec ./spec/controllers/static_controller_spec.rb:114 # StaticController#enter when the redirect path is the login page redirects to the root url
rspec ./spec/controllers/static_controller_spec.rb:107 # StaticController#enter with an invalid URL redirects to the root
rspec ./spec/controllers/static_controller_spec.rb:86 # StaticController#enter with a full url redirects to the correct path
rspec ./spec/controllers/static_controller_spec.rb:57 # StaticController show should redirect to / when logged in and path is /login
rspec ./spec/models/user_profile_spec.rb:13 # UserProfile url validation ensures profile_background is valid
rspec ./spec/models/user_profile_spec.rb:19 # UserProfile url validation ensures background_url is valid
rspec ./spec/controllers/users_controller_spec.rb:345 # UsersController.admin_login logs in admin logs in admin with valid token and SSO enabled
rspec ./spec/controllers/users_controller_spec.rb:336 # UsersController.admin_login logs in admin does log in admin with valid token and SSO disabled
rspec ./spec/controllers/users_controller_spec.rb:100 # UsersController.user_preferences_redirect redirects to their profile when logged in
rspec ./spec/components/search_spec.rb:282 # Search topics search for a topic by url returns the topic
rspec ./spec/components/pretty_text_spec.rb:12 # PrettyText Cooking off topic quoting can correctly populate topic title
rspec ./spec/components/pretty_text_spec.rb:417 # PrettyText tag and category links produces tag links
rspec ./spec/models/user_spec.rb:987 # User.avatar_template_url returns a schemaless avatar template with correct id
rspec ./spec/models/user_spec.rb:991 # User.avatar_template_url returns a schemaless cdn-based avatar template
rspec ./spec/models/user_spec.rb:1054 # User automatic avatar creation sets a system avatar for new users
rspec ./spec/models/user_spec.rb:973 # User.small_avatar_url returns a 45-pixel-wide avatar
rspec ./spec/controllers/invites_controller_spec.rb:182 # InvitesController.show with a valid invite id when redeem returns a user success redirects to the first topic the user was invited to
rspec ./spec/controllers/invites_controller_spec.rb:150 # InvitesController.show with a deleted invite redirects to the root
rspec ./spec/controllers/invites_controller_spec.rb:133 # InvitesController.show with an invalid invite id redirects to the root
rspec ./spec/controllers/invites_controller_spec.rb:294 # InvitesController.redeem_disposable_invite with an invalid invite token redirects to the root
rspec ./spec/serializers/basic_category_serializer_spec.rb:29 # BasicCategorySerializer background_url uses absolute schemaless URL
rspec ./spec/serializers/basic_category_serializer_spec.rb:33 # BasicCategorySerializer background_url uses CDN when available
rspec ./spec/serializers/basic_category_serializer_spec.rb:14 # BasicCategorySerializer logo_url uses absolute schemaless URL
rspec ./spec/serializers/basic_category_serializer_spec.rb:18 # BasicCategorySerializer logo_url uses CDN when available
rspec ./spec/controllers/permalinks_controller_spec.rb:13 # PermalinksController show should work for subfolder installs too
rspec ./spec/controllers/permalinks_controller_spec.rb:23 # PermalinksController show should apply normalizations
rspec ./spec/controllers/permalinks_controller_spec.rb:5 # PermalinksController show should redirect to a permalink's target_url with status 301
rspec ./spec/controllers/user_api_keys_controller_spec.rb:97 # UserApiKeysController create allows for a revoke with no id
rspec ./spec/controllers/user_api_keys_controller_spec.rb:118 # UserApiKeysController create will allow readonly api keys to revoke self
rspec ./spec/controllers/user_badges_controller_spec.rb:66 # UserBadgesController create grants badges from staff
rspec ./spec/controllers/user_avatars_controller_spec.rb:19 # UserAvatarsController show handles non local content correctly
rspec ./spec/controllers/email_controller_spec.rb:14 # EmailController.preferences_redirect when logged in redirects to your user preferences
rspec ./spec/models/permalink_spec.rb:45 # Permalink target_url returns a post url when post_id is set
rspec ./spec/models/permalink_spec.rb:71 # Permalink target_url returns a post url when topic_id, post_id, and category_id are all set for some reason
rspec ./spec/models/permalink_spec.rb:55 # Permalink target_url returns a post url when post_id and topic_id are both set
rspec ./spec/components/file_store/local_store_spec.rb:91 # FileStore::LocalStore.absolute_base_url is present
rspec ./spec/components/file_store/local_store_spec.rb:38 # FileStore::LocalStore.remove_upload moves the file to the tombstone
rspec ./spec/components/file_store/local_store_spec.rb:50 # FileStore::LocalStore.remove_optimized_image moves the file to the tombstone
rspec ./spec/components/file_store/local_store_spec.rb:61 # FileStore::LocalStore.has_been_uploaded? identifies relatives urls
rspec ./spec/components/file_store/local_store_spec.rb:65 # FileStore::LocalStore.has_been_uploaded? identifies local urls
rspec ./spec/components/file_store/local_store_spec.rb:71 # FileStore::LocalStore.has_been_uploaded? identifies local urls when using a CDN
rspec ./spec/components/file_store/local_store_spec.rb:104 # FileStore::LocalStore.relative_base_url is present
rspec ./spec/components/discourse_spec.rb:34 # Discourse base_url when https is on has a non-ssl base url
rspec ./spec/components/discourse_spec.rb:24 # Discourse base_url when https is off has a non https base url
rspec ./spec/components/discourse_spec.rb:44 # Discourse base_url with a non standard port specified returns the non standart port in the base url
rspec ./spec/models/unsubscribe_key_spec.rb:7 # UnsubscribeKey post unsubscribe key can generate a correct url
rspec ./spec/models/category_spec.rb:19 # Category url validation ensures logo_url is valid
rspec ./spec/models/category_spec.rb:26 # Category url validation ensures background_url is valid
rspec ./spec/models/category_spec.rb:534 # Category#url builds a url for normal categories
rspec ./spec/models/category_spec.rb:540 # Category#url for subcategories includes the parent category
rspec ./spec/models/category_spec.rb:552 # Category#url_with_id includes the id in the URL
rspec ./spec/models/category_spec.rb:559 # Category#url_with_id child category includes the id in the URL
rspec ./spec/jobs/clean_up_uploads_spec.rb:36 # Jobs::CleanUpUploads does not delete card background uploads
rspec ./spec/jobs/clean_up_uploads_spec.rb:46 # Jobs::CleanUpUploads does not delete category logo uploads
rspec ./spec/jobs/clean_up_uploads_spec.rb:26 # Jobs::CleanUpUploads does not delete profile background uploads
rspec ./spec/jobs/clean_up_uploads_spec.rb:56 # Jobs::CleanUpUploads does not delete category background url uploads
rspec ./spec/components/cooked_post_processor_spec.rb:413 # CookedPostProcessor.optimize_urls uses schemaless url for uploads
rspec ./spec/components/cooked_post_processor_spec.rb:432 # CookedPostProcessor.optimize_urls when CDN is enabled does not use CDN when login is required
rspec ./spec/components/cooked_post_processor_spec.rb:426 # CookedPostProcessor.optimize_urls when CDN is enabled does not use schemaless CDN url for https uploads
rspec ./spec/components/cooked_post_processor_spec.rb:420 # CookedPostProcessor.optimize_urls when CDN is enabled does use schemaless CDN url for http uploads
rspec ./spec/components/cooked_post_processor_spec.rb:114 # CookedPostProcessor.post_process_images with unsized images adds the width and height to images that don't have them
rspec ./spec/components/cooked_post_processor_spec.rb:211 # CookedPostProcessor.post_process_images with title generates overlay information
rspec ./spec/components/cooked_post_processor_spec.rb:142 # CookedPostProcessor.post_process_images with large images generates overlay information