T-8 to HW Due

  • Ruby Bits 1
    • finishing Level 3
      • There is a difference between using self.my_variable and @my_variable in a class. Although they usually do the same thing, which is to access the instance variable my_variable, but if there is a method my_variable in the class, then self.my_variable = object will send the object to the method my_variable (managing arguments for this seems tricky).
  • Testing with Rspec (codeschool)
    • Level 1
      • Rspec has its own syntax that adds onto the Ruby language
      • Need to run rspec --init in the project directory
      • specifications = tests (spec directory)
      • Its good practice to name specs as: name_spec.rb
      • Made some wrong assumptions about an `require': cannot load such file -- spec_helper (LoadError) error, and decided that I needed to install Bundler, which works together with rvm. I also randomly installed Rails via gem install rails.
      • require a class that you want to test in the _spec.rb file
      • “expectations” are written with the should method (should is called the modifier, and the matcher is what the modifier asks for, like in “should be less than 1”, 1 is the matcher)
      • == false can be substituted with be_false
      • should_not works as a modifier
      • if you want to make tests pending, rather than running them, add an x before the it to make an xit, or use the pending keyword inside the body of the spec
  • Random

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s