Sha256: a4a07cf379db9b44c7469b42b63a0cd27ebe94e60458f0caf503ff8ec3c71d92
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require "spec_helper" RSpec.describe Files::File, :with_test_folder do describe "#read" do before do Files::File.open(test_folder.join("read.txt").to_s, 'w', options) do |f| f.write("contents") end end it "returns the body of the file" do file = Files::File.find(test_folder.join("read.txt").to_s, {}, options) expect(file.read).to eq("contents") end end describe "#write" do it "can take string" do Files::File.open(test_folder.join("write-as-string.txt").to_s, 'w', options) do |f| f.write("I am a string") end file = Files::File.find(test_folder.join("write-as-string.txt").to_s, {}, options) expect(file.read).to eq("I am a string") end it "can take IO object" do Files::File.open(test_folder.join("write-as-io.txt").to_s, 'w', options) do |f| f.write(StringIO.new("I am a string via IO")) end file = Files::File.find(test_folder.join("write-as-io.txt").to_s, {}, options) expect(file.read).to eq("I am a string via IO") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
files.com-1.0.35 | spec/models/file_spec.rb |
files.com-1.0.34 | spec/models/file_spec.rb |