ry / ebb fork watch download tarball
public
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
Ryan Dahl (author)
Mon Mar 17 08:52:19 -0700 2008
commit  213605bb5242a3474f7395d5d50fdbd69ec1a295
tree    37ee175af5a9ced1e2a6e9527a7f36a02fd464ed
parent  d2ee83848661e9374c8736cb7411711ba3862c2d
ebb / test / ebb_rails_test.rb
100644 34 lines (28 sloc) 0.902 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require File.dirname(__FILE__) + '/helper'
 
APP_DIR = File.dirname(__FILE__) + "/rails_app"
EBB_RAILS = "#{Ebb::LIBDIR}/../bin/ebb_rails"
class EbbRailsTest < Test::Unit::TestCase
  # just to make sure there isn't some load error
  def test_version
    out = %x{ruby #{EBB_RAILS} -v}
    assert_match %r{Ebb #{Ebb::VERSION}}, out
  end
  
  def test_parser
    runner = Ebb::Runner::Rails.new
    runner.parse_options("start -c #{APP_DIR} -p #{TEST_PORT}".split)
    assert_equal TEST_PORT, runner.options[:port].to_i
    assert_equal APP_DIR, runner.options[:root]
  end
 
  
  def test_start_app
    Thread.new do
      runner = Ebb::Runner::Rails.new
      runner.run("start -c #{APP_DIR} -p #{TEST_PORT}".split)
    end
    sleep 0.1 until Ebb.running?
    
    response = get '/'
    assert_equal 200, response.code.to_i
    
  ensure
    Ebb.stop_server
    sleep 0.1 while Ebb.running?
  end
end