Permalink
Browse files

Initial Commit

  Gemfile, Rakefile, and Guardfile

  Specs for reference that cover variable assignment, booleans, nil, strings,
  and symbols
  • Loading branch information...
burtlo committed Sep 22, 2011
0 parents commit 987fea5f3b17cd3d6cb33a3ab7dbbd877a896131
Showing with 504 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +5 −0 Gemfile
  3. +25 −0 Gemfile.lock
  4. +6 −0 Guardfile
  5. +34 −0 README.md
  6. +6 −0 Rakefile
  7. +101 −0 spec/assignment_spec.rb
  8. +89 −0 spec/boolean_spec.rb
  9. +22 −0 spec/nil_spec.rb
  10. +168 −0 spec/strings_spec.rb
  11. +47 −0 spec/symbols_spec.rb
@@ -0,0 +1 @@
+.DS_Store
@@ -0,0 +1,5 @@
+source :rubygems
+
+gem 'rspec'
+gem 'guard'
+gem 'guard-rspec'
@@ -0,0 +1,25 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.2)
+ guard (0.5.1)
+ thor (~> 0.14.6)
+ guard-rspec (0.4.0)
+ guard (>= 0.4.0)
+ rspec (2.6.0)
+ rspec-core (~> 2.6.0)
+ rspec-expectations (~> 2.6.0)
+ rspec-mocks (~> 2.6.0)
+ rspec-core (2.6.4)
+ rspec-expectations (2.6.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.6.0)
+ thor (0.14.6)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ guard
+ guard-rspec
+ rspec
@@ -0,0 +1,6 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'rspec', :version => 2, :cli => "--color --format d" do
+ watch(%r{^spec/.+_spec\.rb$})
+end
@@ -0,0 +1,34 @@
+## Sharpening your Weapons
+
+1. Install Git
+2. Install RVM
+3. Install Ruby 1.9.2
+
+## Using Git and Github
+
+1. Create a Github account
+2. Send me a message so I know who you are @burtlo
+3. Add you the UWE Ruby organization
+3. Fork this repository to your account
+4. Clone the repository on your system
+
+## Traveling through the Land of Ruby
+
+1. Install Bundler
+2. bundle install
+2. Run the tests for week 1
+3. Fix the tests
+4. Commit the changes locally
+5. Push the changes to your repository
+
+## Using the resources of the land
+
+1. Login to Travis CI and authorize Travis CI
+2. Select your forked repository to be built
+
+## Getting to know your neighbors
+
+1. Find, follow and share a ruby blog through an RSS reader
+2. Watch a person or another project on Github
+3. Login to us.freenode.net
+4. Login to our Hipchat
@@ -0,0 +1,6 @@
+
+task :default => :spec
+
+task :spec do
+ system "rspec -c spec/*_spec.rb"
+end
@@ -0,0 +1,101 @@
+
+describe "Variable assignment" do
+
+ context "when assignining values" do
+
+ it "should equal the value assigned to it" do
+
+ a = 1
+ a.should eq 1
+
+ end
+
+ it "should allow integers" do
+
+ number = 12
+ number.should eq 12
+
+ end
+
+ it "should allow decimal values" do
+
+ decimal = 3.1425
+ decimal.should eq 3.1425
+
+ end
+
+ it "should allow letters (String)" do
+
+ words = "I welcome you to Munchkin land!"
+ words.should eq "I welcome you to Munchkin land!"
+
+ end
+
+ it "should allow true value (boolean)" do
+
+ boolean = true
+ boolean.should be_true
+
+ end
+
+ it "should allow false value (boolean)" do
+
+ boolean = false
+ boolean.should be_false
+
+ end
+
+ end
+
+ context "when assigning a value multiple times" do
+
+ it "should be the last assigned value" do
+
+ number = 23
+ number = 12
+
+ number.should eq 12
+
+ end
+
+ it "should allow multiple different assignments" do
+
+ value = 1
+ value = "a"
+
+ value.should eq "a"
+
+ end
+
+ end
+
+ context "when comparing two" do
+
+ it "numbers should be equal" do
+
+ a = 1
+ b = 1
+
+ a.should eq b
+
+ end
+
+ it "strings should be equal" do
+
+ a = "abba"
+ b = 'abba'
+
+ a.should eq b
+
+ end
+
+ it "booleans should be equal" do
+
+ a = true
+ b = true
+
+ a.should eq b
+
+ end
+ end
+end
@@ -0,0 +1,89 @@
+
+describe "Boolean" do
+
+ context "when true" do
+
+ it "should be true" do
+
+ value = true
+
+ value.should be_true
+ value.should eq true
+
+ end
+
+ it "should be a TrueClass" do
+
+ value = true
+ value.should be_kind_of TrueClass
+
+ end
+
+ end
+
+ context "when false" do
+
+ it "should be false" do
+
+ value = false
+
+ value.should be_false
+ value.should eq false
+
+ end
+
+ it "should be a FalseClass" do
+
+ value = false
+ value.should be_kind_of FalseClass
+
+ end
+
+ end
+
+ context "when any assigned value" do
+
+ it "should be true" do
+
+ value = "false"
+
+ value.should be_true
+ value.should_not be_kind_of TrueClass
+ value.should be_kind_of String
+ value.should eq "false"
+
+ end
+
+ end
+
+ context "when 0" do
+
+ it "should be true" do
+
+ value = 0
+
+ value.should be_true
+ value.should_not be_kind_of TrueClass
+ value.should be_kind_of Integer
+ value.should eq 0
+
+ end
+
+ end
+
+
+ context "when nil" do
+
+ it "should be false" do
+
+ value = nil
+
+ value.should be_false
+ value.should be_kind_of NilClass
+ value.should be_nil
+
+ end
+
+ end
+
+end
@@ -0,0 +1,22 @@
+
+describe "Nil and the NilClass" do
+
+ context "when assigned to nil" do
+
+ it "should be nil" do
+
+ value = nil
+ value.should be_nil
+
+ end
+
+ it "should be a NilClass" do
+
+ value = nil
+ value.should be_kind_of NilClass
+
+ end
+
+ end
+
+end
Oops, something went wrong.

0 comments on commit 987fea5

Please sign in to comment.