PageRenderTime 76ms CodeModel.GetById 64ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/test/ppane/configuration_test.rb

http://github.com/tgunr/passengerpane
Ruby | 35 lines | 30 code | 5 blank | 0 comment | 1 complexity | 6107a08f9e49683a0c94e648f3cfbf3b MD5 | raw file
 1require File.expand_path('../test_helper', __FILE__)
 2
 3describe "Configuration" do
 4  it "raises an argument error when an unknown configuration key is set" do
 5    configuration = PassengerPane::Configuration.new
 6    lambda {
 7      begin
 8        configuration.set({'unknown' => 'value'})  
 9      rescue ArgumentError => e
10        e.message.should.start_with('There is no configuration named `unknown\'')
11      end
12    }.should.not.raise
13  end
14  
15  it "initializes a configuration with default values" do
16    configuration = PassengerPane::Configuration.new
17  end
18  
19  it "returns all applications" do
20    apps = mock('Applications')
21    PassengerPane::Application.stubs(:all).returns(apps)
22    PassengerPane::Configuration.new.applications.should == apps
23  end
24end
25
26describe "A Configuration" do
27  before do
28    use_fake_apache_directory
29    @configuration = PassengerPane::Configuration.new(fake_apache_directory)
30  end
31  
32  it "returns an httpd configuration instance" do
33    @configuration.httpd.should.be.kind_of?(PassengerPane::HttpdConf)
34  end
35end