Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ConversionObserver::Checker#approve_files

This just moves the files from the check queue to the convert queue
  • Loading branch information...
commit b1c5612d6bbcf93da3e4be0cdbc7032fa4069750 1 parent 3212066
@ymendel authored
Showing with 37 additions and 5 deletions.
  1. +6 −0 lib/conversion_observer/checker.rb
  2. +31 −5 spec/checker_spec.rb
View
6 lib/conversion_observer/checker.rb
@@ -32,6 +32,12 @@ def check_file(file)
end
end
+ def approve_files(files)
+ files.each do |file|
+ ConversionObserver.remove_file_to_check(file)
+ ConversionObserver.add_file_to_convert(file)
+ end
+ end
private
View
36 spec/checker_spec.rb
@@ -188,13 +188,39 @@
end
end
- it 'should approve files'
+ it 'should approve files' do
+ @checker.should respond_to(:approve_files)
+ end
describe 'when approving files' do
- it 'should accept files'
- it 'should require files'
+ before :each do
+ @files = Array.new(3) { |i| stub("file #{i+1}") }
+ ConversionObserver.stubs(:remove_file_to_check)
+ ConversionObserver.stubs(:add_file_to_convert)
+ end
+
+ it 'should accept files' do
+ lambda { @checker.approve_files(@files) }.should_not raise_error(ArgumentError)
+ end
+
+ it 'should require files' do
+ lambda { @checker.approve_files }.should raise_error(ArgumentError)
+ end
- it 'should remove the files from the check queue'
- it 'should add the files to the convert queue'
+ it 'should remove the files from the check queue' do
+ @files.each do |file|
+ ConversionObserver.expects(:remove_file_to_check).with(file)
+ end
+
+ @checker.approve_files(@files)
+ end
+
+ it 'should add the files to the convert queue' do
+ @files.each do |file|
+ ConversionObserver.expects(:add_file_to_convert).with(file)
+ end
+
+ @checker.approve_files(@files)
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.