require "spec_helper" require 'rake' # saves original $stdout in variable # set $stdout as local instance of StringIO # yields to code execution # returns the local instance of StringIO # resets $stdout to original value def capture_stdout out = StringIO.new $stdout = out yield return out.string ensure $stdout = STDOUT end def loaded_files_excluding_current_rake_file $".reject { |file| file.include? "tasks/sufia-fixtures" } end def attempts_max 30 end describe "Rake Tasks" do before (:each) do @rake = Rake::Application.new Rake.application = @rake Rake.application.rake_require("browse-everything-dev", ["#{BrowseEverything::Engine.root}/tasks/"], loaded_files_excluding_current_rake_file) Rake::Task.define_task(:environment) end describe "start" do after (:each) do @rake['app:stop'].invoke end it "start an app" do o = capture_stdout do @rake['app:start'].invoke end o.should include "Starting" attempts = 1 while ((!File.exists?('spec/internal/tmp/pids/server.pid')) && (attempts=+1