Sha256: 5c80c211c131dcccc8b6527e780b735b915b974d45111b709eb9d3b0dc7e2fd0

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

require 'simple_pvr'

module SimplePvr
  describe Recorder do
    before do
      @programme = Model::Programme.new
      @channel = Model::Channel.new(frequency: 282000000, channel_id: 1098)
      @recording = Model::Recording.new(@channel, 'Star Trek', 'start time', 'duration', @programme)
  
      @hdhomerun = double('HDHomeRun')
      PvrInitializer.stub(hdhomerun: @hdhomerun)
  
      @recording_manager = double('RecordingManager')
      @recording_manager.stub(:create_directory_for_recording).with(@recording).and_return('recording directory')  
      PvrInitializer.stub(recording_manager: @recording_manager)
      
      @recorder = Recorder.new(1, @recording)
    end
    
    it 'can start recording' do
      @hdhomerun.should_receive(:start_recording).with(1, 282000000, 1098, 'recording directory')
    
      @recorder.start!
    end
    
    it 'starts fetching programme icon when recording starts' do
      @programme.icon_url = 'http://tv-images.com/myImage.png'
      ProgrammeIconFetcher.should_receive(:fetch).with('http://tv-images.com/myImage.png', 'recording directory/icon')
      @hdhomerun.should_receive(:start_recording)
      
      @recorder.start!
    end
    
    it 'can stop recording as well, and creates a thumbnail' do
      @hdhomerun.stub(:start_recording)
      @hdhomerun.should_receive(:stop_recording).with(1)
      Ffmpeg.should_receive(:create_thumbnail_for).with('recording directory')
    
      @recorder.start!
      @recorder.stop!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_pvr-1.1.0 spec/simple_pvr/recorder_spec.rb