Sha256: 41a96e19b6bb1013f410f8288c24e8778ca8a303087a62bcec2978f8e9449ae5

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_file_rewrite_test"

describe File do

  let(:dir){ File.expand_path File.dirname(__FILE__) }
  let(:file_path){ dir + "tempfile"}
  let(:data_before){ "alpha" } 
  let(:data_after){ "bravo" } 

  describe "#rewrite" do

    before do      
      file = File.new(file_path, "w")
      file.write data_before
      file.close
    end

  	it "rewrite" do
      # Verify before
      file = File.new(file_path)
      expect(file.read).must_equal data_before
      file.close
      # Change
      file.rewrite data_after
      # Verify after
      file = File.new(file_path)
      expect(file.read).must_equal data_after
      file.close
    end

    after do
      File.delete(file_path)
    end

  end

end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sixarm_ruby_file_rewrite-2.0.0 test/sixarm_ruby_file_rewrite_test/file/rewrite_test.rb
sixarm_ruby_file_rewrite-1.0.0 test/sixarm_ruby_file_rewrite_test/file/rewrite_test.rb