Install the Rails gem if you haven't done so before
π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayToList(array) { | |
let result = {}; | |
if (Array.isArray(array)) { | |
let currListItem = result; | |
for (let item of array) { | |
let newListItem = { | |
value: item, | |
rest: null | |
}; | |
if (typeof currListItem.rest === 'undefined') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// step parameter is optional | |
// if step is not passed in, | |
// and start is less than or equal to end, | |
// then step = 1, else step = -1 | |
function range(start, end, step = start <= end ? 1 : -1) { | |
let result = []; | |
// loop iterates up for positive step values | |
// and iterates down for negative step values | |
for (let i = start; step >= 0 ? i <= end : i >= end; i+=step) { | |
result.push(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |