diff --git a/week1/exercises/roster.txt b/week1/exercises/roster.txt index 6a3f6f4..9305f7f 100644 --- a/week1/exercises/roster.txt +++ b/week1/exercises/roster.txt @@ -2,15 +2,16 @@ 0, Renée, renee@nird.us, reneedv, @nirdllc, Renee 1, Katie, katrops@gmail.com, katrops, @kjtrops, Katie 2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, +3, Alex, lumberjackparade@hotmail.com, Pensive1881 +4, Rick, rcrelia@gmail.com, rcrelia, @rcrelia, Rick +5, Edwin, edwin.fu@gmail.com, edwinfu, @edwinfu, +6, Gregg, gpg@gregory-gadow.net, GGadow, n/a, Gregg +7 Alicia, aliciagoodwin@gmail.com, sojama +8, Scott Kostojohn, skostojohn@hotmail.com,skostojohn,@crm_scott, Scott +9, Kenny, lukenny@gmail.com, lukenny, , Kenny +10, Nathan, nathanrohm@gmail.com, natron19, natron19, natron19 +11, Emily, emxruf@gmail.com, no twitter, metroretro, Emily +12, joseph , jjs0sbw@gmail.com, jjs0sbw, @jjs0sbw, huh? 13, -14, +14, Tom, tunderhill@gmail.com, tomun, @tomun, +15, Surendra, mohan.surendra@gmail.com, syearva, , diff --git a/week1/exercises/rspec_spec.rb b/week1/exercises/rspec_spec.rb index 75b3d36..c4c5e0b 100644 --- a/week1/exercises/rspec_spec.rb +++ b/week1/exercises/rspec_spec.rb @@ -78,18 +78,19 @@ # Fix the Failing Test # Order of Operations is Please Excuse My Dear Aunt Sally: # Parentheses, Exponents, Multiplication, Division, Addition, Subtraction - (1+2-5*6/2).should eq -13 + (1+2-5*6/2).should eq -12 end it "should count the characters in your name" do - pending "make a test to count the characters in your name" - "Name".should have(5).characters + "Tom".should have(3).characters end it "should check basic math" do - pending "make a test to check some basic math" + (1+1).should eq 2 end - it "should check basic spelling" + it "should check basic spelling" do + "field".should include("ie") + end end end \ No newline at end of file diff --git a/week2/class_materials/resources.txt b/week2/class_materials/resources.txt new file mode 100644 index 0000000..965c8b3 --- /dev/null +++ b/week2/class_materials/resources.txt @@ -0,0 +1,10 @@ + +Ruby Docs: http://www.ruby-doc.org/core-1.9.3/String.html +Pragmatic Programmers Guide: http://pragprog.com/book/ruby3/programming-ruby-1-9 (at the bottom is the link to the extending Ruby pdf I mentioned) + +Travis CI (where open source projects are tested): https://travis-ci.org +grb: https://github.com/jinzhu/grb +The Ruby ToolBox: https://www.ruby-toolbox.com/ + +my alias for rspec: +alias rspec="rspec --color --format documentation" diff --git a/week2/class_materials/week2.key b/week2/class_materials/week2.key new file mode 100644 index 0000000..fb010aa Binary files /dev/null and b/week2/class_materials/week2.key differ diff --git a/week2/class_materials/week2.pdf b/week2/class_materials/week2.pdf new file mode 100644 index 0000000..93497a0 Binary files /dev/null and b/week2/class_materials/week2.pdf differ diff --git a/week2/examples/.keep b/week2/examples/.keep new file mode 100644 index 0000000..e69de29 diff --git a/week2/exercises/book.rb b/week2/exercises/book.rb new file mode 100644 index 0000000..34931fa --- /dev/null +++ b/week2/exercises/book.rb @@ -0,0 +1,17 @@ +class Book + attr_accessor :title + attr_reader :page_count + + @@book_count = 0 + + def self.book_count + @@book_count + end + + def initialize title = "Not Set", page_count = 0 + @@book_count += 1 + @page_count = page_count + @title = title + end + +end \ No newline at end of file diff --git a/week2/exercises/book_spec.rb b/week2/exercises/book_spec.rb new file mode 100644 index 0000000..4662c1a --- /dev/null +++ b/week2/exercises/book_spec.rb @@ -0,0 +1,49 @@ +require_relative 'book' +require_relative '../../spec_helper' + +describe Book do + + context "::book_count" do + + it "should count how many books have been created" do + Book.new + Book.new + Book.new + Book.book_count.should eq 3 + end + + end + + context "::new" do + + it "should set some defaults" do + Book.new.title.should eq "Not Set" + end + + it "should allow us to set the page count" do + book = Book.new "Harry Potter", 5 + book.page_count.should eq 5 + end + + end + + context "#title" do + + before :each do + @book = Book.new + end + + it "should have a title" do + @book.should respond_to "title" + end + + it "should allow me to set the title" do + @book.title = "Snow Crash" + @book.title.should eq "Snow Crash" + end + + + + end + +end \ No newline at end of file diff --git a/week2/exercises/mad_libs.rb b/week2/exercises/mad_libs.rb new file mode 100644 index 0000000..3af5583 --- /dev/null +++ b/week2/exercises/mad_libs.rb @@ -0,0 +1,10 @@ +puts "Please enter a noun" +noun = gets.chomp +puts "Please enter an adjective" +adjective = gets.chomp +puts "Please enter a past tense action verb" +verb_past_tense = gets.chomp +puts "What does the #{noun} say?" +says = gets.chomp +story = "The #{adjective} #{noun} #{verb_past_tense} past the graveyard and says #{says}" +puts story diff --git a/week2/homework/questions.txt b/week2/homework/questions.txt new file mode 100644 index 0000000..939e42d --- /dev/null +++ b/week2/homework/questions.txt @@ -0,0 +1,13 @@ +Please Read The Chapters on: +Containers, Blocks, and Iterators +Sharing Functionality: Inheritance, Modules, and Mixins + +1. What is the difference between a Hash and an Array? + +2. When would you use an Array over a Hash and vice versa? + +3. What is a module? Enumerable is a built in Ruby module, what is it? + +4. Can you inherit more than one thing in Ruby? How could you get around this problem? + +5. What is the difference between a Module and a Class? diff --git a/week2/homework/simon_says_spec.rb b/week2/homework/simon_says_spec.rb new file mode 100644 index 0000000..4e6f5bc --- /dev/null +++ b/week2/homework/simon_says_spec.rb @@ -0,0 +1,48 @@ +# Hint: require needs to be able to find this file to load it +require_relative "simon_says.rb" +require_relative '../../spec_helper' + +describe SimonSays do + include SimonSays # Hint: Inclusion is different than SimonSays.new (read about modules) + + # Hint: We are just calling methods, we are not passing a message to a SimonSays object. + it "should echo hello" do + echo("hello").should == "hello" + end + + it "should echo bye" do + echo("bye").should == "bye" + end + + it "should shout hello" do + shout("hello").should == "HELLO" + end + + it "should shout multiple words" do + shout("hello world").should == "HELLO WORLD" + end + + it "should repeat" do + repeat("hello").should == "hello hello" + end + + it "should repeat a number of times" do + repeat("hello", 3).should == "hello hello hello" + end + + it "should return the first letter" do + start_of_word("hello", 1).should == "h" + end + + it "should return the first two letters" do + start_of_word("Bob", 2).should == "Bo" + end + + it "should tell us the first word of 'Hello World' is 'Hello'" do + first_word("Hello World").should == "Hello" + end + + it "should tell us the first word of 'oh dear' is 'oh'" do + first_word("oh dear").should == "oh" + end +end