Week 3 Day 11
Namespace n Rspec
What We Did
We fixed our gem to have namespace in the
lib/loremz/cli.rb. Namespace is where the class CLI is encapsulated by module Loremz. The syntax for namespacing is
module Loremz class CLI < Thor #your methods end end
That way our
lib/loremz/cli.rb file matches with the
Why do we want our
lib/loremz.rb file to match?
lib/loremz/cli.rb file is just for handling what comes in the command line. While the content would be stored in the
lib/loremz/cli.rb to call
Today we also worked on writing RSpec tests for the gem we created.
What We Learned from our Boo Boos?
Joyce's ipsum command didn't work because the
require "loremz" in
lib/loremz/cli.rb was left out. We need to include it to load the file