Skip to content
Browse files

Some important Ruby classes described using RSpec

  • Loading branch information...
1 parent e9fbec8 commit 2fe21088008af36eb63fe7a641f8aa214263e88a @nvijayap committed Dec 28, 2013
Showing with 60 additions and 0 deletions.
  1. +55 −0 trpl002.rb
  2. +5 −0 trpl002.sh
View
55 trpl002.rb
@@ -0,0 +1,55 @@
+describe "Some Ruby Classes" do
+
+ #----- String, Fixnum, Float ------
+
+ it "Should be a String" do
+ 9.class.should == Fixnum
+ end
+
+ it "Should be a Fixnum" do
+ 9.class.should == Fixnum
+ end
+
+ it "Should be a Float" do
+ 8.7.class.should == Float
+ end
+
+ #----- Collection Types -----------
+
+ it "Should be an Array" do
+ [].class.should == Array
+ end
+
+ it "Should be a Hash" do
+ {}.class.should == Hash
+ end
+
+ it "Should be a Range" do
+ (0..9).class.should == Range
+ end
+
+ #----- Regex, Symbol --------------
+
+ it "Should be a Regexp" do
+ //.class.should == Regexp
+ end
+
+ it "Should be a Symbol" do
+ :name.class.should == Symbol
+ end
+
+ #----- True, False, Nil -----------
+
+ it "Should be a TrueClass" do
+ true.class.should == TrueClass
+ end
+
+ it "Should be a FalseClass" do
+ false.class.should == FalseClass
+ end
+
+ it "Should be a NilClass" do
+ nil.class.should == NilClass
+ end
+
+end
View
5 trpl002.sh
@@ -0,0 +1,5 @@
+
+cat trpl002.rb
+
+rspec trpl002.rb
+

0 comments on commit 2fe2108

Please sign in to comment.
Something went wrong with that request. Please try again.