From 362ad99a35d0d3d4a99f86f9f5ccf321e986f477 Mon Sep 17 00:00:00 2001 From: Doc Ritezel Date: Sat, 1 Dec 2012 18:00:50 -0800 Subject: [PATCH] wip - add basis of wizard --- .gitignore | 5 +++-- lib/lobot/wizard.rb | 11 +++++++++++ spec/helpers/io_helpers.rb | 14 ++++++++++++++ spec/lib/lobot/wizard_spec.rb | 13 +++++++++++++ spec/spec_helper.rb | 6 ++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 lib/lobot/wizard.rb create mode 100644 spec/helpers/io_helpers.rb create mode 100644 spec/lib/lobot/wizard_spec.rb diff --git a/.gitignore b/.gitignore index faa8f4e..618329e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,8 @@ pkg/* features/config/secrets.yml .idea spec/tmp -spec/reports/ +spec/reports .vagrant .kitchen -.env \ No newline at end of file +.env +/tmp \ No newline at end of file diff --git a/lib/lobot/wizard.rb b/lib/lobot/wizard.rb new file mode 100644 index 0000000..b7f9b98 --- /dev/null +++ b/lib/lobot/wizard.rb @@ -0,0 +1,11 @@ +module Lobot + class Wizard + attr_reader :config + + def initialize(config) + @config = config + end + + def + end +end \ No newline at end of file diff --git a/spec/helpers/io_helpers.rb b/spec/helpers/io_helpers.rb new file mode 100644 index 0000000..5541f07 --- /dev/null +++ b/spec/helpers/io_helpers.rb @@ -0,0 +1,14 @@ +module IOHelpers + def capture(stream = :stdout) + begin + stream = stream.to_s + eval "$#{stream} = StringIO.new" + yield + result = eval("$#{stream}").string + ensure + eval("$#{stream} = #{stream.upcase}") + end + + result + end +end diff --git a/spec/lib/lobot/wizard_spec.rb b/spec/lib/lobot/wizard_spec.rb new file mode 100644 index 0000000..61be0f9 --- /dev/null +++ b/spec/lib/lobot/wizard_spec.rb @@ -0,0 +1,13 @@ +require "spec_helper" + +describe Lobot::Wizard do + let(:lobot_config) { Lobot::Config.new } + + subject { Lobot::Wizard.new(lobot_config) } + + describe "#prompt_for_build_name" do + it "accepts the name of the build" do + capture { subject.prompt_for_build_name } + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 87f8d15..bce96a4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,3 +4,9 @@ require "lobot/cli" require "godot" require "tempfile" + +Dir.glob(File.expand_path("../helpers/**/*.rb", __FILE__)).each { |h| require h} + +RSpec.configure do |config| + config.include IOHelpers +end