Commit 8a77fca
Changed files (5)
lib/bubble_sort.rb
@@ -0,0 +1,5 @@
+class BubbleSort
+ def sort(items)
+ items
+ end
+end
spec/bubble_sort_spec.rb
@@ -0,0 +1,13 @@
+require "spec_helper"
+
+describe BubbleSort do
+ let(:sut) { BubbleSort.new }
+
+ it "should be able to sort an empty array" do
+ sut.sort([]).should == []
+ end
+
+ it "should be able to sort an array with one item" do
+ sut.sort([1]).should == [1]
+ end
+end
spec/spec_helper.rb
@@ -0,0 +1,1 @@
+require_relative '../lib/bubble_sort'
Gemfile
@@ -0,0 +1,2 @@
+source "https://rubygems.org"
+gem 'rspec'
Gemfile.lock
@@ -0,0 +1,18 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ diff-lcs (1.2.4)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.2)
+ rspec-expectations (2.14.0)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rspec