spec/support/shared_matcher_examples.rb in serverspec-0.2.21 vs spec/support/shared_matcher_examples.rb in serverspec-0.2.22
- old
+ new
@@ -92,9 +92,38 @@
it { should_not be_listening }
end
end
end
+shared_examples_for 'support be_reachable matcher' do |valid_host|
+ describe 'be_reachable' do
+ context valid_host do
+ it { should be_reachable }
+ end
+
+ describe 'invalid-host' do
+ it { should_not be_reachable }
+ end
+ end
+end
+
+shared_examples_for 'support be_reachable.with matcher' do |valid_host|
+ describe 'be_reachable.with' do
+ context valid_host do
+ it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
+ end
+ context valid_host do
+ it { should be_reachable.with(:proto => "tcp", :port => 22, :timeout=> 1) }
+ end
+ context valid_host do
+ it { should be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
+ end
+ context 'invalid-host' do
+ it { should_not be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
+ end
+ end
+end
+
shared_examples_for 'support be_mounted matcher' do |valid_mount|
describe 'be_mounted' do
describe valid_mount do
it { should be_mounted }
end