Skip to content

Instantly share code, notes, and snippets.

@katiebuilds
katiebuilds / ruby_test_suite_song.txt
Last active December 10, 2015 01:01
"If We Had A Test Suite" to the tune of "If I Were A Rich Man"
“If I Were a Rich Man” “If We Had a Test Suite”
Original by Katie
(lyrics from http://www.stlyrics.com/lyrics/fiddlerontheroof/ifiwerearichman.htm)
[TEVYE] [TURNER]
"Dear God, you made many, many poor people. Dear team, we wrote lots and lots of crufty code.
I realize, of course, that it's no shame to be poor. I realize, of course, that everyone writes some hacks.
But it's no great honor either! But it’s not great practice either!
So, what would have been so terrible if I had a small fortune?" So, what would have been so terrible if we’d refactored a bit?
Detailed Development Questions
Would you rather use RubyMine, vim, or Sublime Text? Why?
I would rather use RubyMine. So far, I've only used Atom. I feel like Sublime would be very similar to Atom, so if I was going to go through the process of acclimating to a different editor, I'd like to try RubyMine to see if all of its additional functionality is helpful or bothersome. (If I didn't have much time, I'd probably go with Sublime). I feel like there is a learning curve with vim, as far as remembering all the keyboard commands, and I'd rather save that challenge for when I'm more comfortable with code in general.
What is the difference between an INNER JOIN and a LEFT JOIN?
Hmm...SQL commands...I don't remember!
Detailed Supporting Technology Questions
Why would you use SCSS instead of CSS?
SCSS allows you to nest elements inside one another, which may make your file more readable. It also allows you to set variables. Certain frameworks like Bootstrap utilize SCSS, so if you are using one of those, that is the way you need to format your file.
Why would you use JSON instead of HTML?
You would use JSON if you are doing something like creating an API where you want the information to be easily accessible to programs, and you are not so concerned with people seeing the page (there is no fancy user interface with JSON).
Detailed Rails Questions
What is the difference between form_for and form_tag?
Form_for is for an object...if you are collecting data in fields that that particular object has in its database. Form_tag is just for a regular form.
What is the difference between render and redirect_to?
Render displays a page or a form. Redirect_to takes you to another page.
Detailed Ruby Questions
What is the difference between a hash and an array?
A hash (enclosed with {}) stores information in pairs: there is always a key and a value. In order to pull information out of a hash, you have to call it with its key. Information in the hash is not stored in any particular order. Arrays (enclosed with []) store a set of values in a certain order. You can access a particular value in an array with its index, which is a number that refers to a value's position in the array.
What is the difference between a string and a symbol?
"This is a string." :this_is_a_symbol Both are used to store text. There can't be spaces in a symbol. Often, you can choose which to use, although conventionally, there are certain places where you use one or the other.
require 'minitest/autorun'
require 'minitest/pride'
# Write code which will be included in the human class which will give humans
# intelligent and bipedal behavior.
# WRITE YOUR CODE BELOW THIS COMMENT...
module Intelligent
NUMBER_OF_BRAINS = 1
require 'minitest/autorun'
require 'minitest/pride'
# Write two classes which inherit from the Vehicle class below. You will also
# need to add a method to the Vehicle class during this challenge.
class Vehicle
def initialize(make, model)
@make = make
@model = model
require 'minitest/autorun'
require 'minitest/pride'
# Write a class which wraps around an array, but only allows odd numbers
# to be stored in the array.
# WRITE YOUR CODE HERE.
class OddArray
def initialize(array)
require 'minitest/autorun'
require 'minitest/pride'
# Write a class which has an initialize method, a reader method, a private
# method, and a class method.
# WRITE YOUR CODE HERE.
class Goat
attr_reader :name
require 'minitest/autorun'
require 'minitest/pride'
# Write a series of methods which use the .any, .all, .map, .select, .reject, and
# .reduce methods in Enumerable. Each of your methods should be one line.
# WRITE YOUR CODE HERE. In this challenge, names longer than 5 characters are
# considered long.
def has_even?(array)