Sha256: 2abb7690869da248f951f13d5087ea3f45f22f5600b61e34fb663b0ac89726ff

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module VncTools
  describe Recorder do
    context "given a display string" do
      let(:process)  { mock(ChildProcess, :crashed? => false, :start => nil, :stop => nil, :io => mock("io").as_null_object) }
      let(:recorder) { Recorder.new ":1", "out.mp4"  }

      it "knows its display" do
        recorder.display.should == ":1"
      end

      it "knows its output" do
        recorder.output.should == "out.mp4"
      end

      it "starts and stops recording on the given display" do
        ChildProcess.should_receive(:build).with(
          "ffmpeg",
          "-an",               # no audio,
          "-f", "x11grab",     # force format
          "-y",                # overwrite output files
          "-r", "5",           # frame rate
          "-s", "1024x768",    # size
          "-i", ":1.0+0,0",    # display :1
          "-vcodec", "mpeg4",  # default encoding
          "-sameq", "out.mp4"  # output
        ).and_return process

        process.should_receive(:start)
        recorder.start

        process.should_receive(:stop)
        recorder.stop
      end

      it "raises an error if the process crashed" do
        ChildProcess.stub :build => mock(:start => nil, :crashed? => true)

        lambda { recorder.start }.should raise_error
      end
    end
  end # Recorder
end # VncTools

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vnctools-0.0.7 spec/vnctools/recorder_spec.rb
vnctools-0.0.6 spec/vnctools/recorder_spec.rb
vnctools-0.0.5 spec/vnctools/recorder_spec.rb
vnctools-0.0.4 spec/vnctools/recorder_spec.rb
vnctools-0.0.3 spec/vnctools/recorder_spec.rb
vnctools-0.0.2 spec/vnctools/recorder_spec.rb