Skip to content

Commit

Permalink
Fix specs that I broke last night
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jun 3, 2008
1 parent 578770b commit fb7b2d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/engine.rb
Expand Up @@ -58,8 +58,9 @@ def create_path_and_convert(item)
dest_file = Pathname.new(item.target_path)
FileUtils.mkdir_p(dest_file.dirname.to_s)

transcode(item.source_path, dest_file.to_s)
get_screenshot(item.source_path, item.screenshot_path)
ret = transcode(item.source_path, dest_file.to_s)
get_screenshot(item.source_path, item.screenshot_path) unless ret
ret
end

def transcode(input, output)
Expand Down
6 changes: 4 additions & 2 deletions spec/engine_spec.rb
Expand Up @@ -17,14 +17,16 @@
it "Should convert a file and mark it succeeded or failed" do
source = "/path/to/source.avi"
target = "/the/target/source.mp4"
preview = "#{ENV["HOME"]}/.yikes/preview/01e9f4b2924dbcda2296d773017e14d1.jpg"

# Set up our mocks
pass_mock = flexmock("state_pass") {|f| f.should_receive(:encode_succeeded!) }
fail_mock = flexmock("state_fail") {|f| f.should_receive(:encode_failed!) }
flexmock(FileUtils) {|f| f.should_receive(:mkdir_p).with("/the/target")}
flexmock(FileUtils) {|f| f.should_receive(:mkdir_p).and_return "" }

transcoder_mock = flexmock("transcoder")
transcoder_mock.should_receive(:transcode).with(source, target).and_return(true, false)
transcoder_mock.should_receive(:get_screenshot).with(source, preview).times(1).and_return(true)
tc_class = flexmock("transcoder_class")
tc_class.should_receive(:new).and_return(transcoder_mock)

Expand Down Expand Up @@ -54,7 +56,7 @@

it "should build an FFMpeg command line" do
input = "foo"; output = 'bar'
ret = @fft.get_command(input, output)
ret = @fft.get_transcode_command(input, output)

# FIXME: This test sucks
ret.include?(input).should == true
Expand Down

0 comments on commit fb7b2d0

Please sign in to comment.