See just how easy and intuitive CoderPad Interview is to use below.
Guidelines to use Ruby in this online IDE
The Ruby environment is augmented with a few REPL features as well as some helpful libraries.
The REPL uses Pry to provide a REPL with history, highlighting, and autocomplete. Additionally, whenever you run scripts in CoderPad’s editor, the REPL will deposit you at the exact line and state of any exceptions. If there were no errors, you will have a REPL with access to all of the variables and functions defined in your script.
The libraries included and ready for
- minitest is a simple framework suitable for a variety of testing needs, like unit testing, specs, and mocking. To run your tests, require
require 'minitest/autorun' class Dog def talk! 'BARK' end end describe Dog do it 'must bark when spoken to' do _(Dog.new.talk!).must_equal 'BARK' end endCode language: Ruby (ruby)
- RSpec is another very popular library for testing in Ruby. You trigger RSpec in CoderPad by requiring
rspec/autorun. The equivalent of the previous example in RSpec would be:
require 'rspec/autorun' class Dog def talk! 'BARK' end end RSpec.describe Dog do it 'barks when spoken to' do expect(Dog.new.talk!).to eq('BARK') end endCode language: Ruby (ruby)