Sha256: 93996c7d842540a47338dd5362691f7b705effed7f58ec86589ef16bca1b0a74
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
shared_examples_for "handling errors in application initialization" do before :each do @stub = setup_rails_stub('foobar') @stub.use_vendor_rails('minimal') end after :each do teardown_rails_stub end it "raises an AppInitError if the spawned app raises a standard exception during startup" do File.prepend(@stub.environment_rb, "raise 'This is a dummy exception.'\n") begin spawn_stub_application(@stub) 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 "raises an AppInitError if the spawned app raises a custom-defined exception during startup" do File.prepend(@stub.environment_rb, %{ class MyError < StandardError end raise MyError, "This is a custom exception." }) begin spawn_stub_application(@stub) 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 "raises an AppInitError if the spawned app calls exit() during startup" do File.prepend(@stub.environment_rb, "exit\n") begin spawn_stub_application(@stub) violated "Spawning the application should have raised an InitializationError." rescue AppInitError => e e.child_exception.class.should == SystemExit end end end shared_examples_for "handling errors in framework initialization" do include Utils it "raises FrameworkInitError if the framework could not be loaded" do lambda { load_nonexistant_framework }.should raise_error(FrameworkInitError) end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
rockdog-passenger-0.0.1 | test/ruby/rails/spawner_error_handling_spec.rb |
passenger-2.1.2 | test/ruby/rails/spawner_error_handling_spec.rb |