spec/downer/application_spec.rb in downer-0.2.2 vs spec/downer/application_spec.rb in downer-0.3.0

- old
+ new

@@ -2,21 +2,30 @@ module Downer describe Downer do describe "#run!" do + before(:each) do + @output = double('output').as_null_object + @app = Application.new(@output) + end + it "when run without arguments displays a usage hint" do - output = double('output') - app = Application.new(output) - output.should_receive(:puts).with('Usage: downer URL_SOURCE DESTINATION_DIR') - app.run! + @output.should_receive(:puts).with('Usage: downer -flags URL_SOURCE DESTINATION_DIR') + @app.run! end - it "when run with valid arguments displays the number of files to download" do - output = double('output').as_null_object - app = Application.new(output) - output.should_receive(:puts).with("Starting download on 4 files") - app.run!(fixture_directory + "/some_images.txt", '/tmp') + it "when run with -i argument it will download only images" do + @output.should_receive(:puts).with("Images only filter selected...downloading PNG,JPG,GIF, and TIFF files") + @app.run!("-i") + @app.options[:images_only].should == true end + + # it "when run with a -w DATA_SOURCE argument it should start a web download" do + # host = "http://www.urbaninfluence.com" + # @output.should_receive(:puts).with("Requesting from host #{host}") + # arg_cmd = %w{-wi http://www.urbaninfluence.com /tmp} + # @app.run!(arg_cmd) + # end end end end \ No newline at end of file