spec/configliere/config_file_spec.rb in configliere-0.0.2 vs spec/configliere/config_file_spec.rb in configliere-0.0.3

- old
+ new

@@ -2,10 +2,11 @@ Configliere.use :config_file describe "Configliere::ConfigFile" do before do @config = Configliere.new :my_param => 'val' + FileUtils.stub! :mkdir_p end describe 'loads a config file' do before do @config = Configliere::Param.new :my_param => 'val' @@ -46,9 +47,15 @@ end it 'saves a pathname to the given file' do fake_file = StringIO.new('', 'w') File.should_receive(:open).with('/fake/path.yaml', 'w').and_yield(fake_file) fake_file.should_receive(:<<).with("--- \n:my_param: val\n") + @config.save! '/fake/path.yaml' + end + it 'ensures the directory exists' do + fake_file = StringIO.new('', 'w') + File.stub!(:open).with('/fake/path.yaml', 'w').and_yield(fake_file) + FileUtils.should_receive(:mkdir_p).with('/fake') @config.save! '/fake/path.yaml' end end end