Permalink
Browse files

First test with ruby

  • Loading branch information...
1 parent ce7fd9d commit ad622ac77cd0c9d8f575154fbe1dd1c2636e2f15 @PotHix committed Sep 15, 2011
Showing with 28 additions and 0 deletions.
  1. +16 −0 ruby/test/test.rb
  2. +12 −0 ruby/test/test_spec.rb
View
@@ -0,0 +1,16 @@
+class Test
+ def run
+ while check_number(number = gets.chomp)
+ puts number
+ end
+ end
+
+ def check_number(number)
+ number == "42" ? nil : number
+ end
+end
+
+if __FILE__ == $0
+ test = Test.new
+ test.run
+end
@@ -0,0 +1,12 @@
+require "./test"
+require "minitest/autorun"
+
+describe Test do
+ before do
+ @test = Test.new
+ end
+
+ it "should exit if the number is 42" do
+ @test.check_number("42").must_equal nil
+ end
+end

0 comments on commit ad622ac

Please sign in to comment.