Reputation: 33
I have this method in my class
def open
File.open(@filepath,"w") do |f|
@gz = Zlib::GzipWriter.new(f)
@gz.write(%[<?xml version="1.0" encoding="UTF-8"?>\n])
@gz.write(%[<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n])
yield self
@gz.write(%[</urlset>])
@gz.close
end
end
How can I write a good complete spec for this method.
Thanks in advance
Upvotes: 1
Views: 63
Reputation: 21690
Create a temporary filename, use that as @filepath
, write some data, read the data back via File.read(filename)
, unzip it, compare.
Upvotes: 0