Class: Fat::CommandLineFixture

Inherits:
Fit::ColumnFixture show all
Defined in:
lib/fat/command_line_fixture.rb

Overview

This is really testing OptionParser rather than some new RubyFIT code, but it’s nice to have anyway just in case the Ruby standard library behaviour should change between subsequent versions.

Constant Summary

Constants inherited from Fit::Fixture

Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW

Instance Attribute Summary collapse

Attributes inherited from Fit::Fixture

#counts, #listener, #summary

Instance Method Summary collapse

Methods inherited from Fit::ColumnFixture

#check, #do_cell, #do_row, #do_rows, #execute, #reset

Methods inherited from Fit::Fixture

camel, #check, #do_cell, #do_cells, #do_row, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong

Constructor Details

#initializeCommandLineFixture

Returns a new instance of CommandLineFixture.



17
18
19
20
# File 'lib/fat/command_line_fixture.rb', line 17

def initialize
  @options = OptionParser.new
  @options.on('--encoding=ENC') { |enc| @encoding = enc }
end

Instance Attribute Details

#command_lineObject

Returns the value of attribute command_line.



15
16
17
# File 'lib/fat/command_line_fixture.rb', line 15

def command_line
  @command_line
end

#encodingObject (readonly)

Returns the value of attribute encoding.



16
17
18
# File 'lib/fat/command_line_fixture.rb', line 16

def encoding
  @encoding
end

Instance Method Details

#argsObject



27
28
29
30
# File 'lib/fat/command_line_fixture.rb', line 27

def args
  @encoding = 'Implementation-specific'
  @options.parse(command_line.split)
end

#input_fileObject



21
22
23
# File 'lib/fat/command_line_fixture.rb', line 21

def input_file
  args()[0]
end

#output_fileObject



24
25
26
# File 'lib/fat/command_line_fixture.rb', line 24

def output_file
  args()[1]
end