examples/primes/spec/primes_spec.rb in royw-drbman-0.0.4 vs examples/primes/spec/primes_spec.rb in royw-drbman-0.0.5

- old
+ new

@@ -2,10 +2,21 @@ require 'primes' # Note, these assume you have an ssh public key set up for # this box (i.e: it does an "ssh localhost"). +def env_ok + result = !(ENV['TEST_HOST'].nil? || ENV['TEST_USER'].nil? || ENV['TEST_PASSWORD'].nil?) + unless result + puts + puts "You need to setup the following environment variables: TEST_HOST, TEST_USER, TEST_PASSWORD" + puts "Alternatively run spec like: TEST_HOST='box' TEST_USER='who' TEST_PASSWORD='sekret' spec spec/primes_spec.rb" + puts + end + result +end + describe('SieveOfEratosthenes') do before(:each) do @choices = {} @logger = Log4r::Logger.new('primes_spec') @logger.level = Log4r::DEBUG @@ -79,15 +90,5 @@ sieve.execute.length.should == 303 end end -def env_ok - result = !(ENV['TEST_HOST'].nil? || ENV['TEST_USER'].nil? || ENV['TEST_PASSWORD'].nil?) - unless result - puts - puts "You need to setup the following environment variables: TEST_HOST, TEST_USER, TEST_PASSWORD" - puts "Alternatively run spec like: TEST_HOST='box' TEST_USER='who' TEST_PASSWORD='sekret' spec spec/primes_spec.rb" - puts - end - result -end