spec/apache/config_spec.rb in apache-config-generator-0.2.6 vs spec/apache/config_spec.rb in apache-config-generator-0.2.7

- old
+ new

@@ -31,10 +31,44 @@ it { should be_true } end end + describe '.disable!' do + context 'is enabled by default' do + it { apache.instance_variable_get(:@is_disabled).should be_false } + it { apache.disabled?.should be_false } + + context 'writes config' do + before { + FileUtils.expects(:mkdir_p).once + File.expects(:open).once + apache.build("here") { cats } + } + + it { apache.written?.should == true } + end + end + + context 'disable' do + before { apache.disable! } + + it { apache.instance_variable_get(:@is_disabled).should be_true } + it { apache.disabled?.should be_true } + + context 'does not write config' do + before { + FileUtils.expects(:mkdir_p).never + File.expects(:open).never + apache.build("here") { disable!; cats } + } + + it { apache.written?.should == false } + end + end + end + it "should handle indent" do apache.line_indent = 1 [ [ 'hello', ' hello' ], @@ -82,12 +116,16 @@ name.blockify.should == attribute end end it "should handle a build" do + apache.written?.should be_false + FileUtils.mkdir_p 'test' apache.build('test/fake.conf') { my_test "this" }.should == [ 'MyTest "this"' ] FileUtils.rm 'test/fake.conf' + + apache.written?.should be_true end it "should handle building if the environment is correct" do set_apache_env(:test)