Class: Conify::Test
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Helpers
#allow_user_response, #ask_for_conflux_creds, #ask_for_password, #ask_for_password_on_windows, #camelize, #display, #echo_off, #echo_on, #error, #exclusive_deep_merge, #format_with_bang, #host, #host_url, #kensa_manifest_name, #kensa_manifest_path, #manifest_content, #manifest_filename, #manifest_path, #manually_added_methods, #open_url, #running_on_a_mac?, #running_on_windows?, #site_url, #to_table, #with_tty
Constructor Details
#initialize(data) ⇒ Test
Returns a new instance of Test.
9
10
11
|
# File 'lib/conify/test.rb', line 9
def initialize(data)
@data = data
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
6
7
8
|
# File 'lib/conify/test.rb', line 6
def data
@data
end
|
Instance Method Details
#api_requires?(feature) ⇒ Boolean
47
48
49
|
# File 'lib/conify/test.rb', line 47
def api_requires?(feature)
data['api'].fetch('requires', []).include?(feature)
end
|
#env ⇒ Object
13
14
15
|
# File 'lib/conify/test.rb', line 13
def env
@data.fetch('env', 'test')
end
|
#run(klass, data) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/conify/test.rb', line 21
def run(klass, data)
test_name = klass.to_s.gsub('Conify::', '').split(/(?=[A-Z])/).join(' ')
begin
klass.new(data).call
rescue Exception => e
error "#{test_name} #{e.message}"
end
if klass.const_defined?('OUTPUT_COMPLETION') && klass.const_get('OUTPUT_COMPLETION')
display "#{test_name}: Looks good..."
end
end
|
#test(msg, &block) ⇒ Object
17
18
19
|
# File 'lib/conify/test.rb', line 17
def test(msg, &block)
raise "Failed: #{msg}" unless block.call
end
|
#url ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/conify/test.rb', line 35
def url
if data['api'][env].is_a? Hash
base = data['api'][env]['base_url']
uri = URI.parse(base)
uri.query = nil
uri.path = ''
uri.to_s
else
data['api'][env].chomp('/')
end
end
|