Permalink
Browse files

Merge "allow :renderer option for TaskTracker for custom renderers"

  • Loading branch information...
drnic authored and Gerrit Code Review committed Nov 9, 2012
2 parents 4388c6b + bc35a11 commit 11d74a4a02b6dcf0205a0e5a4c55ee3c638d5cc2
Showing with 9 additions and 1 deletion.
  1. +5 −1 cli/lib/cli/task_tracker.rb
  2. +4 −0 cli/spec/unit/task_tracker_spec.rb
@@ -10,6 +10,8 @@ class TaskTracker
attr_reader :output
+ attr_reader :renderer
+
# @param [Bosh::Cli::Director] director
# @param [Integer] task_id
# @param [Hash] options
@@ -28,7 +30,9 @@ def initialize(director, task_id, options = {})
@cache = Config.cache
@task = Bosh::Cli::DirectorTask.new(@director, @task_id, @log_type)
- if options[:raw_output]
+ if options[:renderer]
+ @renderer = options[:renderer]
+ elsif options[:raw_output]
@renderer = Bosh::Cli::TaskLogRenderer.new
else
@renderer = Bosh::Cli::TaskLogRenderer.create_for_log_type(@log_type)
@@ -124,4 +124,8 @@ def make_tracker(task_id, options)
tracker.track.should == :cancelled
end
+ it "accepts alternate :renderer option" do
+ tracker = make_tracker("42", {:renderer => "I'm a renderer"})
+ tracker.renderer.should == "I'm a renderer"
+ end
end

0 comments on commit 11d74a4

Please sign in to comment.