Sha256: 69877091c41c7016df3feb0103a13fcae8ec6bde62bc5ce58f3e54f27d0845ed
Contents?: true
Size: 1007 Bytes
Versions: 3
Compression:
Stored size: 1007 Bytes
Contents
require 'spec_helper' require 'fileutils' require 'tmpdir' describe FileSlicer do describe '.remove!' do let :before_remove do File.join spec_dir, 'data', 'slicer', 'before_remove' end let :after_remove do File.join spec_dir, 'data', 'slicer', 'after_remove' end it 'removes a range of lines from a file' do Dir.mktmpdir do |tmp_dir| FileUtils.cp before_remove, tmp_dir test_file = File.join tmp_dir, 'before_remove' FileSlicer.remove! test_file, 3..6 test_file_contents = File.open(test_file).read after_remove_contents = File.open(after_remove).read test_file_contents.should == after_remove_contents end end end describe '#remove' do it 'returns lines with the range removed' do lines = [ 'a', 'b', 'c', 'd' ] slicer = FileSlicer.new lines slicer.remove(1..2).should == ['a', 'd'] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reveal-ck-0.1.2 | spec/lib/reveal-ck/file_slicer_spec.rb |
reveal-ck-0.1.1 | spec/lib/reveal-ck/file_slicer_spec.rb |
reveal-ck-0.1.0 | spec/lib/reveal-ck/file_slicer_spec.rb |