Class: MiniTest::Unit::TestCase
Instance Method Summary
collapse
-
#create_plugin(yml_file_name_or_options_hash) ⇒ Object
-
#dirs_same?(a, b) ⇒ Boolean
-
#generate_path(file_name_part, tmp_dir = nil) ⇒ Object
-
#load_options(yml_name) ⇒ Object
-
#mkdir_in_tmp_dir(prefix, tmp_dir = nil) ⇒ Object
-
#mock_file(name, retval, args = []) ⇒ Object
-
#must_log(level) ⇒ Object
-
#must_log_from(level) ⇒ Object
-
#must_log_msg(msg, level) ⇒ Object
-
#new_mock_file ⇒ Object
-
#prepare_options(src_yml_path, replace_data) ⇒ Object
-
#prepare_test_dir(dir_name_part, tmp_dir = nil) ⇒ Object
-
#prepare_test_file(file_name_part, tmp_dir = nil) ⇒ Object
-
#prepare_yml(src_yml_path, replace_data, tmp_dir = nil) ⇒ Object
-
#show_log ⇒ Object
-
#wont_log(level) ⇒ Object
-
#wont_log_from(level) ⇒ Object
-
#wont_log_msg(msg, level) ⇒ Object
#siba_file, siba_file, siba_file=
#after_teardown, #before_setup
Instance Method Details
#create_plugin(yml_file_name_or_options_hash) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/siba/helpers/test/extend_test.rb', line 43
def create_plugin(yml_file_name_or_options_hash)
if yml_file_name_or_options_hash.is_a? String
load_options yml_file_name_or_options_hash
else
@options = yml_file_name_or_options_hash
end
unless @plugin_category
raise Siba::Error, "Initialize '@plugin_category' variable (#{Siba::Plugins.categories_str})"
end
unless @plugin_type
raise Siba::Error, "Initialize '@plugin_type' variable with your gem name ('cloud', 'ftp' etc)."
end
Siba::PluginLoader.loader.load(@plugin_category, @plugin_type, @options)
end
|
#dirs_same?(a, b) ⇒ Boolean
89
90
91
|
# File 'lib/siba/helpers/test/extend_test.rb', line 89
def dirs_same?(a,b)
Siba::FileHelper::dirs_same? a, b
end
|
#generate_path(file_name_part, tmp_dir = nil) ⇒ Object
#load_options(yml_name) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/siba/helpers/test/extend_test.rb', line 61
def load_options(yml_name)
unless @yml_path
raise Siba::Error, "Initialize '@yml_path' variable with the dir to test YAML files."
end
yml_name = yml_name + ".yml" unless yml_name =~ /\.yml$/
@options = SibaTest.load_options File.join(@yml_path, yml_name)
end
|
#mkdir_in_tmp_dir(prefix, tmp_dir = nil) ⇒ Object
#mock_file(name, retval, args = []) ⇒ Object
33
34
35
36
37
|
# File 'lib/siba/helpers/test/extend_test.rb', line 33
def mock_file(name, retval, args=[])
mock = new_mock_file
mock.expect name, retval, args
mock
end
|
#must_log(level) ⇒ Object
5
6
7
|
# File 'lib/siba/helpers/test/extend_test.rb', line 5
def must_log(level)
verify_log true, level, true
end
|
#must_log_from(level) ⇒ Object
13
14
15
|
# File 'lib/siba/helpers/test/extend_test.rb', line 13
def must_log_from(level)
verify_log true, level, false
end
|
#must_log_msg(msg, level) ⇒ Object
21
22
23
|
# File 'lib/siba/helpers/test/extend_test.rb', line 21
def must_log_msg(msg, level)
verify_log_msg msg, true, level
end
|
#new_mock_file ⇒ Object
39
40
41
|
# File 'lib/siba/helpers/test/extend_test.rb', line 39
def new_mock_file
Siba::FilePlug.siba_file = MiniTest::Mock.new
end
|
#prepare_options(src_yml_path, replace_data) ⇒ Object
93
94
95
|
# File 'lib/siba/helpers/test/extend_test.rb', line 93
def prepare_options(src_yml_path, replace_data)
Siba::TestFiles::prepare_options(src_yml_path, replace_data)
end
|
#prepare_test_dir(dir_name_part, tmp_dir = nil) ⇒ Object
#prepare_test_file(file_name_part, tmp_dir = nil) ⇒ Object
#prepare_yml(src_yml_path, replace_data, tmp_dir = nil) ⇒ Object
97
98
99
100
|
# File 'lib/siba/helpers/test/extend_test.rb', line 97
def prepare_yml(src_yml_path, replace_data, tmp_dir=nil)
tmp_dir ||= SibaTest.tmp_dir
Siba::TestFiles::prepare_yml src_yml_path, replace_data, tmp_dir
end
|
#show_log ⇒ Object
29
30
31
|
# File 'lib/siba/helpers/test/extend_test.rb', line 29
def show_log
puts Siba::SibaLogger.messages.map{|a| a.msg}.join("\n")
end
|
#wont_log(level) ⇒ Object
9
10
11
|
# File 'lib/siba/helpers/test/extend_test.rb', line 9
def wont_log(level)
verify_log false, level, true
end
|
#wont_log_from(level) ⇒ Object
17
18
19
|
# File 'lib/siba/helpers/test/extend_test.rb', line 17
def wont_log_from(level)
verify_log false, level, false
end
|
#wont_log_msg(msg, level) ⇒ Object
25
26
27
|
# File 'lib/siba/helpers/test/extend_test.rb', line 25
def wont_log_msg(msg, level)
verify_log_msg msg, false, level
end
|