forked from itsderek23/highgroove-scout-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_helper.rb
More file actions
18 lines (17 loc) · 706 Bytes
/
test_helper.rb
File metadata and controls
18 lines (17 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'test/unit'
require 'rubygems'
require 'mocha' # gem install mocha
require 'fakeweb' # gem install fakeweb
require 'timecop' # gem install timecop
require 'scout'
class Test::Unit::TestCase
# Reads the code and extracts default options. The argument should be the name of
# both the plugin directory and the file. This assumes the directory and filename are the same.
def parse_defaults(name)
code=File.read("#{File.dirname(__FILE__)}/#{name}/#{name}.rb")
@options={}
raw_options=Scout::PluginOptions.from_yaml(Scout::Plugin.extract_options_yaml_from_code(code))
raw_options.select{|r|r.has_default?}.each{|o|@options[o.name]=o.default}
return @options
end
end