dump 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -15
- data/.rubocop_todo.yml +1 -1
- data/Gemfile +6 -1
- data/LICENSE.txt +1 -1
- data/README.markdown +2 -2
- data/dump.gemspec +2 -2
- data/lib/dump.rb +86 -2
- data/lib/{dump_rake/archive_tar_minitar_fix.rb → dump/archive_tar_minitar.rb} +0 -0
- data/lib/{dump_rake → dump}/assets.rb +6 -4
- data/lib/dump/capistrano/v2.rb +34 -34
- data/lib/{dump_rake → dump}/continious_timeout.rb +1 -1
- data/lib/{dump_rake → dump}/env.rb +4 -4
- data/lib/{dump_rake → dump}/env/filter.rb +1 -1
- data/lib/dump/rails_root.rb +19 -0
- data/lib/{dump_rake/dump_reader.rb → dump/reader.rb} +25 -17
- data/lib/{dump_rake/dump.rb → dump/snapshot.rb} +9 -5
- data/lib/{dump_rake → dump}/table_manipulation.rb +28 -14
- data/lib/{dump_rake/dump_writer.rb → dump/writer.rb} +13 -5
- data/lib/tasks/assets.rake +4 -4
- data/lib/tasks/dump.rake +10 -10
- data/script/update_readme +3 -3
- data/spec/cycle_spec.rb +78 -84
- data/spec/{lib/dump_rake → dump}/env/filter_spec.rb +14 -14
- data/spec/dump/env_spec.rb +139 -0
- data/spec/{lib/dump_rake → dump}/rails_root_spec.rb +11 -13
- data/spec/{lib/dump_rake/dump_reader_spec.rb → dump/reader_spec.rb} +89 -89
- data/spec/dump/snapshot_spec.rb +290 -0
- data/spec/{lib/dump_rake → dump}/table_manipulation_spec.rb +54 -55
- data/spec/{lib/dump_rake/dump_writer_spec.rb → dump/writer_spec.rb} +41 -42
- data/spec/dump_spec.rb +327 -0
- data/spec/recipes/dump_spec.rb +92 -93
- data/spec/spec_helper.rb +0 -3
- data/spec/tasks/assets_spec.rb +16 -15
- data/spec/tasks/dump_spec.rb +30 -29
- metadata +75 -98
- data/.autotest +0 -13
- data/lib/dump_rake.rb +0 -94
- data/lib/dump_rake/rails_root.rb +0 -13
- data/spec/lib/dump_rake/dump_spec.rb +0 -289
- data/spec/lib/dump_rake/env_spec.rb +0 -139
- data/spec/lib/dump_rake_spec.rb +0 -326
- data/spec/spec.opts +0 -4
    
        data/spec/lib/dump_rake_spec.rb
    DELETED
    
    | @@ -1,326 +0,0 @@ | |
| 1 | 
            -
            require 'spec_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe DumpRake do
         | 
| 4 | 
            -
              describe 'versions' do
         | 
| 5 | 
            -
                it 'should call Dump.list if called without version' do
         | 
| 6 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return([])
         | 
| 7 | 
            -
                  DumpRake.versions
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                it 'should call Dump.list with options if called with version' do
         | 
| 11 | 
            -
                  expect(DumpRake::Dump).to receive(:list).with(:like => '123').and_return([])
         | 
| 12 | 
            -
                  DumpRake.versions(:like => '123')
         | 
| 13 | 
            -
                end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
                it 'should print versions' do
         | 
| 16 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return(%w[123.tgz 456.tgz])
         | 
| 17 | 
            -
                  expect(grab_output do
         | 
| 18 | 
            -
                    DumpRake.versions
         | 
| 19 | 
            -
                  end[:stdout]).to eq("123.tgz\n456.tgz\n")
         | 
| 20 | 
            -
                end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                it 'should not show summary if not asked for' do
         | 
| 23 | 
            -
                  dumps = %w[123.tgz 456.tgz].map do |s|
         | 
| 24 | 
            -
                    dump = double("dump_#{s}", :path => double("dump_#{s}_path"))
         | 
| 25 | 
            -
                    expect(DumpRake::DumpReader).not_to receive(:summary)
         | 
| 26 | 
            -
                    dump
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return(dumps)
         | 
| 30 | 
            -
                  grab_output do
         | 
| 31 | 
            -
                    expect($stderr).not_to receive(:puts)
         | 
| 32 | 
            -
                    DumpRake.versions
         | 
| 33 | 
            -
                  end
         | 
| 34 | 
            -
                end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                it 'should show summary if asked for' do
         | 
| 37 | 
            -
                  dumps = %w[123.tgz 456.tgz].map do |s|
         | 
| 38 | 
            -
                    dump = double("dump_#{s}", :path => double("dump_#{s}_path"))
         | 
| 39 | 
            -
                    expect(DumpRake::DumpReader).to receive(:summary).with(dump.path)
         | 
| 40 | 
            -
                    dump
         | 
| 41 | 
            -
                  end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return(dumps)
         | 
| 44 | 
            -
                  grab_output do
         | 
| 45 | 
            -
                    expect($stderr).not_to receive(:puts)
         | 
| 46 | 
            -
                    DumpRake.versions(:summary => '1')
         | 
| 47 | 
            -
                  end
         | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                it 'should show summary with scmema if asked for' do
         | 
| 51 | 
            -
                  dumps = %w[123.tgz 456.tgz].map do |s|
         | 
| 52 | 
            -
                    dump = double("dump_#{s}", :path => double("dump_#{s}_path"))
         | 
| 53 | 
            -
                    expect(DumpRake::DumpReader).to receive(:summary).with(dump.path, :schema => true)
         | 
| 54 | 
            -
                    dump
         | 
| 55 | 
            -
                  end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return(dumps)
         | 
| 58 | 
            -
                  grab_output do
         | 
| 59 | 
            -
                    expect($stderr).not_to receive(:puts)
         | 
| 60 | 
            -
                    DumpRake.versions(:summary => '2')
         | 
| 61 | 
            -
                  end
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                it 'should show output to stderr if summary raises error' do
         | 
| 65 | 
            -
                  allow(DumpRake::DumpReader).to receive(:summary)
         | 
| 66 | 
            -
                  dumps = %w[123.tgz 456.tgz].map do |s|
         | 
| 67 | 
            -
                    double("dump_#{s}", :path => double("dump_#{s}_path"))
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
                  expect(DumpRake::DumpReader).to receive(:summary).with(dumps[1].path).and_raise('terrible error')
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                  expect(DumpRake::Dump).to receive(:list).and_return(dumps)
         | 
| 72 | 
            -
                  grab_output do
         | 
| 73 | 
            -
                    allow($stderr).to receive(:puts)
         | 
| 74 | 
            -
                    expect($stderr).to receive(:puts) do |s|
         | 
| 75 | 
            -
                      expect(s['terrible error']).not_to be_nil
         | 
| 76 | 
            -
                    end
         | 
| 77 | 
            -
                    DumpRake.versions(:summary => 'true')
         | 
| 78 | 
            -
                  end
         | 
| 79 | 
            -
                end
         | 
| 80 | 
            -
              end
         | 
| 81 | 
            -
             | 
| 82 | 
            -
              describe 'create' do
         | 
| 83 | 
            -
                describe 'naming' do
         | 
| 84 | 
            -
                  it "should create file in 'rails app root'/dump" do
         | 
| 85 | 
            -
                    allow(File).to receive(:rename)
         | 
| 86 | 
            -
                    expect(DumpRake::DumpWriter).to receive(:create) do |path|
         | 
| 87 | 
            -
                      expect(File.dirname(path)).to eq(File.join(DumpRake::RailsRoot, 'dump'))
         | 
| 88 | 
            -
                    end
         | 
| 89 | 
            -
                    grab_output do
         | 
| 90 | 
            -
                      DumpRake.create
         | 
| 91 | 
            -
                    end
         | 
| 92 | 
            -
                  end
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                  it "should create file with name like 'yyyymmddhhmmss.tmp' when called without description" do
         | 
| 95 | 
            -
                    allow(File).to receive(:rename)
         | 
| 96 | 
            -
                    expect(DumpRake::DumpWriter).to receive(:create) do |path|
         | 
| 97 | 
            -
                      expect(File.basename(path)).to match(/^\d{14}\.tmp$/)
         | 
| 98 | 
            -
                    end
         | 
| 99 | 
            -
                    grab_output do
         | 
| 100 | 
            -
                      DumpRake.create
         | 
| 101 | 
            -
                    end
         | 
| 102 | 
            -
                  end
         | 
| 103 | 
            -
             | 
| 104 | 
            -
                  it "should create file with name like 'yyyymmddhhmmss-Some text and _.tmp' when called with description 'Some text and !@'" do
         | 
| 105 | 
            -
                    allow(File).to receive(:rename)
         | 
| 106 | 
            -
                    expect(DumpRake::DumpWriter).to receive(:create) do |path|
         | 
| 107 | 
            -
                      expect(File.basename(path)).to match(/^\d{14}-Some text and _\.tmp$/)
         | 
| 108 | 
            -
                    end
         | 
| 109 | 
            -
                    grab_output do
         | 
| 110 | 
            -
                      DumpRake.create(:desc => 'Some text and !@')
         | 
| 111 | 
            -
                    end
         | 
| 112 | 
            -
                  end
         | 
| 113 | 
            -
             | 
| 114 | 
            -
                  it "should create file with name like 'yyyymmddhhmmss@super tag,second.tmp' when called with description 'Some text and !@'" do
         | 
| 115 | 
            -
                    allow(File).to receive(:rename)
         | 
| 116 | 
            -
                    expect(DumpRake::DumpWriter).to receive(:create) do |path|
         | 
| 117 | 
            -
                      expect(File.basename(path)).to match(/^\d{14}-Some text and _\.tmp$/)
         | 
| 118 | 
            -
                    end
         | 
| 119 | 
            -
                    grab_output do
         | 
| 120 | 
            -
                      DumpRake.create(:desc => 'Some text and !@')
         | 
| 121 | 
            -
                    end
         | 
| 122 | 
            -
                  end
         | 
| 123 | 
            -
             | 
| 124 | 
            -
                  it 'should rename file after creating' do
         | 
| 125 | 
            -
                    expect(File).to receive(:rename) do |tmp_path, tgz_path|
         | 
| 126 | 
            -
                      expect(File.basename(tmp_path)).to match(/^\d{14}-Some text and _\.tmp$/)
         | 
| 127 | 
            -
                      expect(File.basename(tgz_path)).to match(/^\d{14}-Some text and _\.tgz$/)
         | 
| 128 | 
            -
                    end
         | 
| 129 | 
            -
                    allow(DumpRake::DumpWriter).to receive(:create)
         | 
| 130 | 
            -
                    grab_output do
         | 
| 131 | 
            -
                      DumpRake.create(:desc => 'Some text and !@')
         | 
| 132 | 
            -
                    end
         | 
| 133 | 
            -
                  end
         | 
| 134 | 
            -
             | 
| 135 | 
            -
                  it 'should output file name' do
         | 
| 136 | 
            -
                    allow(File).to receive(:rename)
         | 
| 137 | 
            -
                    allow(DumpRake::DumpWriter).to receive(:create)
         | 
| 138 | 
            -
                    expect(grab_output do
         | 
| 139 | 
            -
                      DumpRake.create(:desc => 'Some text and !@')
         | 
| 140 | 
            -
                    end[:stdout]).to match(/^\d{14}-Some text and _\.tgz$/)
         | 
| 141 | 
            -
                  end
         | 
| 142 | 
            -
                end
         | 
| 143 | 
            -
             | 
| 144 | 
            -
                describe 'writing' do
         | 
| 145 | 
            -
                  it 'should dump schema, tables, assets' do
         | 
| 146 | 
            -
                    allow(File).to receive(:rename)
         | 
| 147 | 
            -
                    @dump = double('dump')
         | 
| 148 | 
            -
                    expect(DumpRake::DumpWriter).to receive(:create)
         | 
| 149 | 
            -
             | 
| 150 | 
            -
                    grab_output do
         | 
| 151 | 
            -
                      DumpRake.create
         | 
| 152 | 
            -
                    end
         | 
| 153 | 
            -
                  end
         | 
| 154 | 
            -
                end
         | 
| 155 | 
            -
              end
         | 
| 156 | 
            -
             | 
| 157 | 
            -
              describe 'restore' do
         | 
| 158 | 
            -
                describe 'without version' do
         | 
| 159 | 
            -
                  it 'should call Dump.list' do
         | 
| 160 | 
            -
                    allow(DumpRake::Dump).to receive(:list)
         | 
| 161 | 
            -
                    expect(DumpRake::Dump).to receive(:list).and_return([])
         | 
| 162 | 
            -
                    grab_output do
         | 
| 163 | 
            -
                      DumpRake.restore
         | 
| 164 | 
            -
                    end
         | 
| 165 | 
            -
                  end
         | 
| 166 | 
            -
             | 
| 167 | 
            -
                  it 'should not call DumpReader.restore and should call Dump.list and output it to $stderr if there are no versions at all' do
         | 
| 168 | 
            -
                    allow(DumpRake::Dump).to receive(:list).and_return([])
         | 
| 169 | 
            -
                    expect(DumpRake::DumpReader).not_to receive(:restore)
         | 
| 170 | 
            -
                    all_dumps = double('all_dumps')
         | 
| 171 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(no_args).and_return(all_dumps)
         | 
| 172 | 
            -
                    grab_output do
         | 
| 173 | 
            -
                      expect($stderr).to receive(:puts).with(kind_of(String))
         | 
| 174 | 
            -
                      expect($stderr).to receive(:puts).with(all_dumps)
         | 
| 175 | 
            -
                      DumpRake.restore
         | 
| 176 | 
            -
                    end
         | 
| 177 | 
            -
                  end
         | 
| 178 | 
            -
             | 
| 179 | 
            -
                  it 'should not call DumpReader.restore and should call Dump.list and output it to $stderr if there are no versions at all' do
         | 
| 180 | 
            -
                    allow(DumpRake::Dump).to receive(:list).and_return([])
         | 
| 181 | 
            -
                    expect(DumpRake::DumpReader).not_to receive(:restore)
         | 
| 182 | 
            -
                    all_dumps = double('all_dumps')
         | 
| 183 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(no_args).and_return(all_dumps)
         | 
| 184 | 
            -
                    grab_output do
         | 
| 185 | 
            -
                      expect($stderr).to receive(:puts).with(kind_of(String))
         | 
| 186 | 
            -
                      expect($stderr).to receive(:puts).with(all_dumps)
         | 
| 187 | 
            -
                      DumpRake.restore('213')
         | 
| 188 | 
            -
                    end
         | 
| 189 | 
            -
                  end
         | 
| 190 | 
            -
             | 
| 191 | 
            -
                  it 'should call DumpReader.restore if there are versions' do
         | 
| 192 | 
            -
                    @dump = double('dump', :path => 'dump/213.tgz')
         | 
| 193 | 
            -
                    expect(DumpRake::Dump).to receive(:list).once.and_return([@dump])
         | 
| 194 | 
            -
                    expect(DumpRake::DumpReader).to receive(:restore).with('dump/213.tgz')
         | 
| 195 | 
            -
                    grab_output do
         | 
| 196 | 
            -
                      expect($stderr).not_to receive(:puts)
         | 
| 197 | 
            -
                      DumpRake.restore
         | 
| 198 | 
            -
                    end
         | 
| 199 | 
            -
                  end
         | 
| 200 | 
            -
                end
         | 
| 201 | 
            -
             | 
| 202 | 
            -
                describe 'with version' do
         | 
| 203 | 
            -
                  it 'should call Dump.list with options' do
         | 
| 204 | 
            -
                    allow(DumpRake::Dump).to receive(:list)
         | 
| 205 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(:like => '213').and_return([])
         | 
| 206 | 
            -
                    grab_output do
         | 
| 207 | 
            -
                      DumpRake.restore(:like => '213')
         | 
| 208 | 
            -
                    end
         | 
| 209 | 
            -
                  end
         | 
| 210 | 
            -
             | 
| 211 | 
            -
                  it 'should not call DumpReader.restore and should call versions if desired version not found' do
         | 
| 212 | 
            -
                    allow(DumpRake::Dump).to receive(:list).and_return([])
         | 
| 213 | 
            -
                    expect(DumpRake::DumpReader).not_to receive(:restore)
         | 
| 214 | 
            -
                    all_dumps = double('all_dumps')
         | 
| 215 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(no_args).and_return(all_dumps)
         | 
| 216 | 
            -
                    grab_output do
         | 
| 217 | 
            -
                      expect($stderr).to receive(:puts).with(kind_of(String))
         | 
| 218 | 
            -
                      expect($stderr).to receive(:puts).with(all_dumps)
         | 
| 219 | 
            -
                      DumpRake.restore('213')
         | 
| 220 | 
            -
                    end
         | 
| 221 | 
            -
                  end
         | 
| 222 | 
            -
             | 
| 223 | 
            -
                  it 'should call DumpReader.restore if there is desired version' do
         | 
| 224 | 
            -
                    @dump = double('dump', :path => 'dump/213.tgz')
         | 
| 225 | 
            -
                    expect(DumpRake::Dump).to receive(:list).once.and_return([@dump])
         | 
| 226 | 
            -
                    expect(DumpRake::DumpReader).to receive(:restore).with('dump/213.tgz')
         | 
| 227 | 
            -
                    expect(DumpRake).not_to receive(:versions)
         | 
| 228 | 
            -
                    grab_output do
         | 
| 229 | 
            -
                      expect($stderr).not_to receive(:puts)
         | 
| 230 | 
            -
                      DumpRake.restore(:like => '213')
         | 
| 231 | 
            -
                    end
         | 
| 232 | 
            -
                  end
         | 
| 233 | 
            -
             | 
| 234 | 
            -
                  it 'should call DumpReader.restore on last version if found multiple matching versions' do
         | 
| 235 | 
            -
                    @dump_a = double('dump_a', :path => 'dump/213-a.tgz')
         | 
| 236 | 
            -
                    @dump_b = double('dump_b', :path => 'dump/213-b.tgz')
         | 
| 237 | 
            -
                    expect(DumpRake::Dump).to receive(:list).once.and_return([@dump_a, @dump_b])
         | 
| 238 | 
            -
                    expect(DumpRake::DumpReader).to receive(:restore).with('dump/213-b.tgz')
         | 
| 239 | 
            -
                    grab_output do
         | 
| 240 | 
            -
                      expect($stderr).not_to receive(:puts)
         | 
| 241 | 
            -
                      DumpRake.restore(:like => '213')
         | 
| 242 | 
            -
                    end
         | 
| 243 | 
            -
                  end
         | 
| 244 | 
            -
                end
         | 
| 245 | 
            -
              end
         | 
| 246 | 
            -
             | 
| 247 | 
            -
              describe 'cleanup' do
         | 
| 248 | 
            -
                it 'should call ask for all files in dump dir and for dumps' do
         | 
| 249 | 
            -
                  expect(DumpRake::Dump).to receive(:list).with(:all => true).and_return([])
         | 
| 250 | 
            -
                  expect(DumpRake::Dump).to receive(:list).with({}).and_return([])
         | 
| 251 | 
            -
                  DumpRake.cleanup
         | 
| 252 | 
            -
                end
         | 
| 253 | 
            -
             | 
| 254 | 
            -
                it 'should call Dump.list with options if called with version and tags' do
         | 
| 255 | 
            -
                  expect(DumpRake::Dump).to receive(:list).with(:like => '123', :tags => 'a,b,c', :all => true).and_return([])
         | 
| 256 | 
            -
                  expect(DumpRake::Dump).to receive(:list).with(:like => '123', :tags => 'a,b,c').and_return([])
         | 
| 257 | 
            -
                  DumpRake.cleanup(:like => '123', :tags => 'a,b,c')
         | 
| 258 | 
            -
                end
         | 
| 259 | 
            -
             | 
| 260 | 
            -
                {
         | 
| 261 | 
            -
                  {} => [0..4],
         | 
| 262 | 
            -
                  {:leave => '3'} => [0..6],
         | 
| 263 | 
            -
                  {:leave => '5'} => [0..4],
         | 
| 264 | 
            -
                  {:leave => '9'} => [0],
         | 
| 265 | 
            -
                  {:leave => '10'} => [],
         | 
| 266 | 
            -
                  {:leave => '15'} => [],
         | 
| 267 | 
            -
                  {:leave => 'none'} => [0..9],
         | 
| 268 | 
            -
                }.each do |options, ids|
         | 
| 269 | 
            -
                  it "should call delete #{ids} dumps when called with #{options}" do
         | 
| 270 | 
            -
                    dumps = %w[a b c d e f g h i j].map do |s|
         | 
| 271 | 
            -
                      double("dump_#{s}", :ext => 'tgz', :path => double("dump_#{s}_path"))
         | 
| 272 | 
            -
                    end
         | 
| 273 | 
            -
                    tmp_dumps = %w[a b c].map do |s|
         | 
| 274 | 
            -
                      double("tmp_dump_#{s}", :ext => 'tmp', :path => double("tmp_dump_#{s}_path"))
         | 
| 275 | 
            -
                    end
         | 
| 276 | 
            -
                    all_dumps = tmp_dumps[0, 1] + dumps[0, 5] + tmp_dumps[1, 1] + dumps[5, 5] + tmp_dumps[2, 1]
         | 
| 277 | 
            -
             | 
| 278 | 
            -
                    (dumps.values_at(*ids) + [tmp_dumps[0], tmp_dumps[2]]).each do |dump|
         | 
| 279 | 
            -
                      expect(dump).to receive(:lock).and_yield
         | 
| 280 | 
            -
                      expect(dump.path).to receive(:unlink)
         | 
| 281 | 
            -
                    end
         | 
| 282 | 
            -
                    [tmp_dumps[1]].each do |dump|
         | 
| 283 | 
            -
                      expect(dump).to receive(:lock)
         | 
| 284 | 
            -
                      expect(dump.path).not_to receive(:unlink)
         | 
| 285 | 
            -
                    end
         | 
| 286 | 
            -
                    (dumps - dumps.values_at(*ids)).each do |dump|
         | 
| 287 | 
            -
                      expect(dump).not_to receive(:lock)
         | 
| 288 | 
            -
                      expect(dump.path).not_to receive(:unlink)
         | 
| 289 | 
            -
                    end
         | 
| 290 | 
            -
             | 
| 291 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(hash_including(:all => true)).and_return(all_dumps)
         | 
| 292 | 
            -
                    expect(DumpRake::Dump).to receive(:list).with(hash_not_including(:all => true)).and_return(dumps)
         | 
| 293 | 
            -
                    grab_output do
         | 
| 294 | 
            -
                      DumpRake.cleanup({:like => '123', :tags => 'a,b,c'}.merge(options))
         | 
| 295 | 
            -
                    end
         | 
| 296 | 
            -
                  end
         | 
| 297 | 
            -
                end
         | 
| 298 | 
            -
             | 
| 299 | 
            -
                it 'should print to stderr if can not delete dump' do
         | 
| 300 | 
            -
                  dumps = %w[a b c d e f g h i j].map do |s|
         | 
| 301 | 
            -
                    dump = double("dump_#{s}", :ext => 'tgz', :path => double("dump_#{s}_path"))
         | 
| 302 | 
            -
                    allow(dump).to receive(:lock).and_yield
         | 
| 303 | 
            -
                    allow(dump.path).to receive(:unlink)
         | 
| 304 | 
            -
                    dump
         | 
| 305 | 
            -
                  end
         | 
| 306 | 
            -
             | 
| 307 | 
            -
                  expect(dumps[3].path).to receive(:unlink).and_raise('Horrible error')
         | 
| 308 | 
            -
             | 
| 309 | 
            -
                  allow(DumpRake::Dump).to receive(:list).and_return(dumps)
         | 
| 310 | 
            -
                  grab_output do
         | 
| 311 | 
            -
                    allow($stderr).to receive(:puts)
         | 
| 312 | 
            -
                    expect($stderr).to receive(:puts) do |s|
         | 
| 313 | 
            -
                      expect(s[dumps[3].path.to_s]).not_to be_nil
         | 
| 314 | 
            -
                      expect(s['Horrible error']).not_to be_nil
         | 
| 315 | 
            -
                    end
         | 
| 316 | 
            -
                    DumpRake.cleanup
         | 
| 317 | 
            -
                  end
         | 
| 318 | 
            -
                end
         | 
| 319 | 
            -
             | 
| 320 | 
            -
                it "should raise if called with :leave which is not a number or 'none'" do
         | 
| 321 | 
            -
                  expect do
         | 
| 322 | 
            -
                    DumpRake.cleanup(:leave => 'nothing')
         | 
| 323 | 
            -
                  end.to raise_error
         | 
| 324 | 
            -
                end
         | 
| 325 | 
            -
              end
         | 
| 326 | 
            -
            end
         | 
    
        data/spec/spec.opts
    DELETED