We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
passenger / test / spawner_error_handling_spec.rb
100644 36 lines (32 sloc) 1.324 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
35
36
shared_examples_for "handling errors in application initialization" do
  it "should raise an AppInitError if the spawned app raises a standard exception during startup" do
    begin
      spawn_application('stub/broken-railsapp')
      violated "Spawning the application should have raised an InitializationError."
    rescue AppInitError => e
      e.child_exception.message.should == "This is a dummy exception."
    end
  end
  
  it "should raise an AppInitError if the spawned app raises a custom-defined exception during startup" do
    begin
      spawn_application('stub/broken-railsapp3')
      violated "Spawning the application should have raised an InitializationError."
    rescue AppInitError => e
      e.child_exception.message.should == "This is a custom exception. (MyError)"
    end
  end
  
  it "should raise an AppInitError if the spawned app calls exit() during startup" do
    begin
      spawn_application('stub/broken-railsapp2')
      violated "Spawning the application should have raised an InitializationError."
    rescue AppInitError => e
      e.child_exception.should be_nil
    end
  end
end
 
shared_examples_for "handling errors in framework initialization" do
  include Utils
  it "should raise FrameworkInitError if the framework could not be loaded" do
    lambda { load_nonexistant_framework }.should raise_error(FrameworkInitError)
  end
end