Module: Sauce::Utilities
- Included in:
- RailsServer
- Defined in:
- lib/sauce/utilities.rb,
lib/sauce/utilities/rake.rb,
lib/sauce/utilities/connect.rb,
lib/sauce/utilities/rails_server.rb
Defined Under Namespace
Modules: Rake
Classes: Connect, RailsServer
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.incorrectly_integrated_warning(style = :rspec) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/sauce/utilities.rb', line 52
def self.incorrectly_integrated_warning(style = :rspec)
case style
when :cuke
tests = 'features'
runner = 'Cucumber'
tag = '@selenium'
else :rspec
tests = 'specs'
runner = 'RSpec'
tag = ':sauce => true'
end
return "\n===============================================================================\nYour \#{tests} used the Sauce Selenium driver, but not the \#{runner} integration.\nThis may result in undesired behaviour, such as configured platforms being\nskipped.\n\nYou can correct this by tagging \#{tests} intended for Sauce with\n'\#{tag}'.\n\nYou can disable this message by setting the 'warn_on_skipped_integration'\nconfig option to false.\n===============================================================================\n stringend\nend\n"
|
.page_deprecation_message ⇒ Object
45
46
47
48
49
50
|
# File 'lib/sauce/utilities.rb', line 45
def self.page_deprecation_message
return "[DEPRECATED] Using the #page method is deprecated for RSpec tests without Capybara. Please use the #s or #selenium method instead.\nIf you are using Capybara and are seeing this message, check the Capybara README for information on how to include the Capybara DSL in your tests.\n MESSAGE\nend\n"
|
.warn_if_suspect_misconfiguration(style = :rspec) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/sauce/utilities.rb', line 35
def self.warn_if_suspect_misconfiguration(style = :rspec)
if Sauce::Selenium2.used_at_least_once?
integrated = Sauce::Config.called_from_integrations?
warnings_on = Sauce::Config.new[:warn_on_skipped_integration]
unless (integrated && warnings_on)
STDERR.puts Sauce::Utilities.incorrectly_integrated_warning(style)
end
end
end
|
Instance Method Details
#silence_stream(stream) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/sauce/utilities.rb', line 10
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
stream.sync = true
yield
ensure
stream.reopen(old_stream)
end
|
#wait_for_server_on_port(port) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/sauce/utilities.rb', line 19
def wait_for_server_on_port(port)
while true
begin
Timeout::timeout(2) do
socket = TCPSocket.new('127.0.0.1', port)
socket.close unless socket.nil?
return
end
rescue Errno::ECONNREFUSED,
Errno::EBADF,
Timeout::Error
end
sleep 2
end
end
|