Module: Belly::Client
- Included in:
- Belly
- Defined in:
- lib/belly/client.rb,
lib/belly/client/config.rb,
lib/belly/client/hub_proxy.rb,
lib/belly/client/default_config.rb
Defined Under Namespace
Classes: Config, DefaultConfig, HubProxy, NoSuchProjectError
Instance Method Summary
collapse
Instance Method Details
#config ⇒ Object
36
37
38
|
# File 'lib/belly/client.rb', line 36
def config
@config ||= Config.new
end
|
#hub ⇒ Object
40
41
42
|
# File 'lib/belly/client.rb', line 40
def hub
@hub ||= HubProxy.new(config)
end
|
#publish(scenario) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/belly/client.rb', line 3
def publish(scenario)
return if offline?
feature_name = scenario.feature.name.split("\n").first feature_file, line = scenario.file_colon_line.split(':')
data = Messages::CucumberScenarioResultMessage.new(
feature_name,
scenario,
config.user,
config.project,
feature_file,
line).to_json
Belly.log("publishing #{data}")
thread = Thread.new { hub.post_test_result(data) }
at_exit do
begin
thread.join
rescue SocketError, Errno::ECONNREFUSED => exception
unless offline?
warn("Belly couldn't send your results to the server (#{Belly.config.url}).")
offline!
end
end
end
end
|