Class Webgen::TestCase
In: lib/webgen/test.rb
Parent: Test::Unit::TestCase
RuntimeError PluginParamNotFound PluginNotFound ConfigurationFileInvalid CmdParse::CommandParser CommandParser DirectoryInfo GalleryStyle WebSiteStyle WebSiteTemplate SipttraStyle Test::Unit::TestCase TestCase PluginTestCase TagTestCase CmdParse::Command ShowCommand CheckCommand UseCommand CreateCommand TSort DependencyHash Hash Comparable Language ::Logger Logger Logger DEFAULT_WRAPPER_MODULE WebSite Qt::MainWindow MainWindow Qt::Dialog NewWebsiteDialog Qt::TextEdit LogWidget ::Rake::TaskLib WebgenTask ConfigurationFile Website PluginManager PluginLoader PluginParamValueNotFound Dummy Color CliUtils PluginDefs lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/gui/common.rb lib/webgen/plugin.rb lib/webgen/test.rb lib/webgen/cli.rb ClassMethods PluginDefs LanguageManager lib/webgen/gui/new_website_dlg.rb lib/webgen/gui/main.rb GUI lib/webgen/rake/webgentask.rb Rake Webgen dot/m_60_1.png

Base class for all webgen test cases. It specifies some auxilary methods helpful when developing tests.

Methods

Public Class methods

Returns the base fixture path for the test case. If filename is specified, it is appended to the base fixture path.

[Source]

    # File lib/webgen/test.rb, line 58
58:     def self.base_fixture_path( filename = nil )
59:       path_helper( :@base_fixture_path, filename )
60:     end

If filename is not specified, returns the fixture path for the test case. If filename is specified, it is appended to the fixture path.

[Source]

    # File lib/webgen/test.rb, line 47
47:     def self.fixture_path( filename = nil )
48:       path_helper( :@fixture_path, filename )
49:     end

Sets the base fixture path and the fixture path for the test case.

[Source]

    # File lib/webgen/test.rb, line 15
15:     def self.inherited( klass )
16:       path = caller[0][/^.*?:/][0..-2]
17:       dir, file = File.split( path )
18:       parent_path, unit_tests = File.split( dir )
19: 
20:       fpath = if dir == '.'
21:                 File.join( '..', 'fixtures' )
22:               else
23:                 File.join( parent_path, 'fixtures' )
24:               end
25: 
26:       klass.instance_variable_set( :@fixture_path, File.join( fpath, File.basename( file, '.*' ) ) )
27:       klass.instance_variable_set( :@base_fixture_path, fpath + '/' )
28:     end

Helper method for retrieving a path name with an optionally appended filename.

[Source]

    # File lib/webgen/test.rb, line 40
40:     def self.path_helper( var, filename = nil )
41:       var = instance_variable_get( var )
42:       (filename.nil? ? var : File.join( var, filename ) )
43:     end

Reimplemented to hide the base test case.

[Source]

    # File lib/webgen/test.rb, line 31
31:     def self.suite
32:       if self == TestCase
33:         return Test::Unit::TestSuite.new('Webgen::TestCase')
34:       else
35:         super
36:       end
37:     end

Public Instance methods

See TestCase.base_fixture_path

[Source]

    # File lib/webgen/test.rb, line 63
63:     def base_fixture_path( filename = nil )
64:       self.class.base_fixture_path( filename )
65:     end

See TestCase.fixture_path

[Source]

    # File lib/webgen/test.rb, line 52
52:     def fixture_path( filename = nil )
53:       self.class.fixture_path( filename )
54:     end

[Validate]