canvas-lms/gems
Cody Cutrer 2ed15f8d05 spec: automatically require spec_helper
[skip-stages=Flakey]

so we don't have to manually do it, especially with increasingly
complicated relative paths.

and stop manually requiring it in plugins, and also convert any other
require File.expand_path to require_relative

Change-Id: Ifc07149372fe09bcc146ac1b980feb3a9fd62865
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276816
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-26 17:39:19 +00:00
..
activesupport-suspend_callbacks RuboCop: Lint 2021-09-29 03:38:23 +00:00
acts_as_list RuboCop: Lint/AssignmentInCondition config, db and doc 2021-09-28 03:33:05 +00:00
adheres_to_policy RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
attachment_fu RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
autoextend RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
bookmarked_collection RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
broadcast_policy RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
canvas_breach_mitigation RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_cache RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
canvas_cassandra RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
canvas_color RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_crummy RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_dynamodb RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_errors RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_ext RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
canvas_http RuboCop: Lint/AssignmentInCondition config, db and doc 2021-09-28 03:33:05 +00:00
canvas_i18nliner Add typescript support 2021-08-18 18:21:17 +00:00
canvas_kaltura RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_mimetype_fu RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_panda_pub RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_partman bump inst-jobs 2021-10-07 20:20:27 +00:00
canvas_quiz_statistics RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
canvas_sanitize RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_security Issue asymmetric jwts from the /jwts endpoint 2021-10-07 16:50:27 +00:00
canvas_slug RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_sort RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_stringex RuboCop: Lint 2021-09-29 03:38:23 +00:00
canvas_text_helper RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_time RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
canvas_unzip RuboCop: Lint/AssignmentInCondition config, db and doc 2021-09-28 03:33:05 +00:00
config_file RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
csv_diff RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
diigo RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
dr_diff RuboCop: Lint 2021-09-29 03:38:23 +00:00
dynamic_settings RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
event_stream RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
google_drive RuboCop: Lint 2021-09-29 03:38:23 +00:00
html_text_helper RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
i18n_extraction correctlies fix RSpec/ExampleWording adverb flubs 2021-10-15 17:14:28 +00:00
i18n_tasks RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
incoming_mail_processor RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
inst_access add User global_ids to InstAccess Tokens 2021-10-15 16:04:50 +00:00
json_token RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
linked_in RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
live_events RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
lti-advantage RuboCop: Lint 2021-09-29 03:38:23 +00:00
lti_outbound RuboCop: Lint/UnusedMethodArgument gems 2021-10-25 18:57:24 +00:00
multipart RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
paginated_collection RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
plugins spec: automatically require spec_helper 2021-10-26 17:39:19 +00:00
request_context RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
rubocop-canvas rubocop-canvas: remove Specs/NoBeforeAll cop 2021-10-05 19:58:58 +00:00
stringify_ids RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
tatl_tael RuboCop: Lint 2021-09-29 03:38:23 +00:00
turnitin_api RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
twitter RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
utf8_cleaner RuboCop: Style/Encoding 2021-09-27 20:52:15 +00:00
workflow RuboCop: Style/Alias 2021-10-05 21:12:23 +00:00
README.md extract ConfigFile to gem 2021-02-23 21:18:20 +00:00
test_all_gems.sh remove broken vendored gems html reports 2021-06-15 16:53:17 +00:00

README.md

Gems

This folder is a place to extract modular functionality from canvas. Canvas's Gemfile arrangement is enabled to read gems from this path locally without installing from a remote source. This is valuable for a few reasons:

  • it prevents circular dependencies (bundler won't allow it)
  • modularized code cannot bind to specific domain concepts on canvas models
  • gems can have their specs run independently, without needing to load all of canvas, saving iteration time
  • it allows for eventual build optimization via only running specs for the transitive closure of parents depending on a gem where a change is.
  • it gives ENGINES extracted from canvas (see the "engines" directory) a place to reference code shared with canvas without it being packaged into the canvas monolith directly.

There are some tradeoffs:

  • spreads canvas over more subdirectories, giving some mental overhad to traversing the entire codebase.
  • modular tests necessarily don't test integration with canvas concepts, so solid integration tests in the app are still a requirement.
  • total SERIALIZED build time goes up because each gem loads it's specs in a new process rather than all running within an already booted canvas process.

[TODO] eventually write more on whether we feel like those tradeoffs are good ones, and what the best practices are to leverage this pattern for max-gain/min-pain.

Testing

To test all the gems:

cd gems
./test_all_gems.sh

To test an individual gem

Run ./test.sh inside the gem's folder. This is basically the same as:

cd gems/google_drive
bundle
rspec