module Ammeter::RSpec::Rails::GeneratorExampleHelpers
def set_shell_prompt_responses(generator, command_args={})
ex. set_shell_prompt_responses(generator, { yes?: [true, false] })
This will allow for different return values upon each call.
The values for each element in the hash can be set as an array as well.
Hash { command_name: input_value, ask: "Testing", yes?: true }
Generator w/ @shell attribute
===== Parameters =====
Does this by mocking return values using RSpec's `and_return` method
Sets return values for basic shell commands (ex. ask, yes?, no?).
def set_shell_prompt_responses(generator, command_args={}) command_args.each do |k,v| allow(generator.shell).to receive(k.to_sym).and_return(*v) end end