This document discusses various Ruby array and string methods like capitalize, each_char, map, sample, shuffle, zip, and more. Code snippets demonstrate how to use these methods on arrays and strings in Ruby. The document also discusses using Node.js and IRB to test Ruby code snippets and the potential to write tests for Ruby code using a BDD style.
26. What if we can write
and test like this
require '../src/com/ciphor/ruby/Array.js'
describe 'com.ciphor.ruby.Array', ->
testArray = null
beforeEach ->
testArray = [1, 2, 3, 4, 5]
Test for BDD -
Behaviour Driven
afterEach ->
testArray = null
Developement
it 'adds all elements in the given array into the self', ->
testArray.push_all [6, 7, 8]
expect(testArray.length).toEqual(8)
expect(testArray).toContain(8)