Permalink
Browse files

Fix specs that I broke last night

  • Loading branch information...
1 parent 578770b commit fb7b2d0511edb5181a4b0aef77cb80c1e499e891 @paulcbetts committed Jun 3, 2008
Showing with 7 additions and 4 deletions.
  1. +3 −2 lib/engine.rb
  2. +4 −2 spec/engine_spec.rb
View
@@ -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)
View
@@ -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)
@@ -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

0 comments on commit fb7b2d0

Please sign in to comment.