module TestHelper
Module to include in tests that provides helper functions.
Public Instance Methods
cli(options = [])
click to toggle source
Creates instance of Cli
.
@param [Array] options Parsed by getopts
@return [StandupMD::Cli]
# File test/test_helper.rb, line 58 def cli(options = []) StandupMD::Cli.new(options) end
create_standup_file(file, fixture = 'previous_entry')
click to toggle source
Creates the standup file with entries.
@param [String] file The name of the file to create
@param [String] fixture Fixture to add to the file
@return [Hash]
# File test/test_helper.rb, line 42 def create_standup_file(file, fixture = 'previous_entry') dir = File.dirname(file) FileUtils.mkdir(dir) unless File.directory?(dir) File.open(file, 'w') do |f| f.puts fixtures[fixture] f.puts f.puts fixtures['current_entry'] end end
fixtures()
click to toggle source
Reads the fixtures in as a hash.
@return [Hash]
# File test/test_helper.rb, line 15 def fixtures @test_helper_fixtures ||= YAML.load(ERB.new(File.read( File.join(__dir__, 'fixtures.yml.erb') )).result(binding)) end
standup(directory, args = {})
click to toggle source
Creates StandupUP
instance. Directory must be passed, usually a subdirectory of test
, so we don't overwrite the user's standup file.
@param [String] directory @param [Hash] args Optional hash of attributes to set
@return [StandupMD]
# File test/test_helper.rb, line 29 def standup(directory, args = {}) args['directory'] = directory StandupMD.load(args) end