Commit e1fe68f

mo khan <mo@mokhan.ca>
2015-01-24 18:58:52
upgrade heap spec.
1 parent 8faf501
Changed files (1)
spec
data_structures
spec/data_structures/heap_spec.rb
@@ -3,40 +3,40 @@ require "spec_helper"
 describe Heap do
   context :min do
     context "emtpy" do
-      it "should return nil" do
+      it "returns nil" do
         heap = Heap.new
-        heap.min.should be_nil
-        heap.empty?.should be_true
+        expect(heap.min).to be_nil
+        expect(heap).to be_empty
       end
     end
 
     context "full" do
-      it "should return the items order from lowest to highest" do
+      it "returns the items order from lowest to highest" do
         n = 10
         numbers = Array.new(n) { rand(n) }
         heap = Heap.heapify(numbers.dup)
 
         results = []
         results << heap.min until heap.empty?
-        results.should == numbers.sort
+        expect(results).to eql(numbers.sort)
       end
     end
   end
 
   context :max do
-    it "should return nil when empty" do
+    it "returns nil when empty" do
       heap = Heap.new
-      heap.max.should be_nil
-      heap.empty?.should be_true
+      expect(heap.max).to be_nil
+      expect(heap).to be_empty
     end
 
-    it "should return the items in order from highest to lowest" do
+    it "returns the items in order from highest to lowest" do
       n = 10
       numbers = Array.new(n) { rand(n) }
       heap = Heap.heapify(numbers.dup)
       results = []
       results.push(heap.max) until heap.empty?
-      results.should == numbers.sort.reverse
+      expect(results).to eql(numbers.sort.reverse)
     end
   end
 end