Skip to content

Code Challenges Authoring Cheat Sheet


Ruby + rspec Code Challenge

  • author: /assessments/5d41a30fbc78fb3c6eef050f
  • LE authoring: /authoring/assessments/5d41a30fbc78fb3c6eef050f
  • LE preview: /assessments/5d41a30fbc78fb3c6eef050f

The Process

  1. Hit the + in sidebar to create a code challenge
  2. Choose your prompt, configuration, default file, backend type, etc.
  3. Click on workspace to get to authoring mode: /authoring/assessments/:id
  4. Preview shows you what user will experience in LE: /assessments/:id

Workspace Authoring

  • NEW! No need to specify a workspace slug in Author. LE auto-creates the workspace.
  • Use the file nav and code editor to create and edit workspace
  • Save the workspace with Upload Initial button
  • Go back to last saved workspace with Get Initial button
  • Folder upload tool lets you upload an entire folder from your file system

Test type <> Workspace type mapping

Test Type Workspace Type Notes
Bats Test all -
Component Test all WebBrowser component tests (.loadedURL() and .loadedOneOf()) are not supported.
Web SCT all -
Java JUnit Test Java -
Mocha Test Babel, BabelNode, Node Use Babel for React, use BabelNode for import/export syntax in Node, and use Node for generic JS scripting tests.
PHPUnit Test PHP _
Python Test Python 3 _
R Script Test R _
RSpec Test Ruby, Ruby on Rails -

Pro Tips

  1. Create a backend type and default filename before you create the workspace.
  2. Use ?latest_draft_applied=true to view unpublished changes in preview/authoring view
  3. Preview will not work until you have created a workspace in authoring.
  4. If you rename the default file in authoring, you'll need to change the filename in Author
  5. Make sure your backend type supports your test type (Author does not validate this)
  6. Be sure to remove the test file before you save your final changes
  7. In you switch from preview mode to authoring mode, hit the Reset icon to confirm what the user will see
  8. You may be able to see the test code in authoring mode, but editing it there will not change the test.
  9. Component tests are limited to CodeEditor and OutputTerminal
  10. Don't forget to add a tests/ directory to the workspace if you use mocha / php tests.
  11. Babel containers require an entry file called app.js or index.js in order to run

Known Issues We're Working On

  1. Eliminate weird effects of changing workspace type (ready to release)
  2. Adding error / success confirmations for successful upload in LE authoring
  3. Check Answer button should also run code (stay tuned)