title: Create a Ruby RSpec test case for file input
body: <p>I have a text file which I intend to convert to a CSV (in this case) format. How do I create a proper RSpec test to see if the output will be in the proper format for the following scenario?</p>
  
  <p>This is my code:</p>
  
  <pre><code>class ProcessLog
      @@log = Array.new
      def read_log(log)
          if File.exists?(log) 
              f = File.open(log, "r")
          f.each_line { |line| @@log &lt;&lt; line.strip }
          end
      end
      def process_log
         result = Array.new
         @@log.each do |line|
            &lt;convert to csv&gt;
            result &lt;&lt; &lt;converted to csv&gt;
         end
         result
      end
  end
  
  describe ProcessLog do
      before do
          @pl = ProcessLog.new
          &lt;help&gt;
      end
      it 'should pass first format' do
          text = "Item X has a price of $ per gram" # just as an example
          &lt;help&gt;
          @pl.read_log("file.log")
          @pl.should == 'X,$,gram'
      end
  end
  </code></pre>