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 <<-stringend
===============================================================================
Your #{tests} used the Sauce Selenium driver, but not the #{runner} integration.
This may result in undesired behaviour, such as configured platforms being
skipped.
You can correct this by tagging #{tests} intended for Sauce with
'#{tag}'.
You can disable this message by setting the 'warn_on_skipped_integration'
config option to false.
===============================================================================
stringend
end
|
.page_deprecation_message ⇒ Object
45
46
47
48
49
50
|
# File 'lib/sauce/utilities.rb', line 45
def self.page_deprecation_message
return <<-MESSAGE
[DEPRECATED] Using the #page method is deprecated for RSpec tests without Capybara. Please use the #s or #selenium method instead.
If 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.
MESSAGE
end
|
.warn_if_suspect_misconfiguration(style = :rspec) ⇒ Object
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
|