File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ source 'https://rubygems.org'
2+
3+ gem 'rspec'
4+ gem 'serverspec'
5+ gem 'rake'
Original file line number Diff line number Diff line change 1+ GEM
2+ remote: https://rubygems.org/
3+ specs:
4+ diff-lcs (1.2.5 )
5+ highline (1.6.20 )
6+ net-ssh (2.8.0 )
7+ rake (10.1.1 )
8+ rspec (2.14.1 )
9+ rspec-core (~> 2.14.0 )
10+ rspec-expectations (~> 2.14.0 )
11+ rspec-mocks (~> 2.14.0 )
12+ rspec-core (2.14.7 )
13+ rspec-expectations (2.14.5 )
14+ diff-lcs (>= 1.1.3 , < 2.0 )
15+ rspec-mocks (2.14.5 )
16+ serverspec (0.15.1 )
17+ highline
18+ net-ssh
19+ rspec (>= 2.13.0 )
20+ specinfra (>= 0.5.4 )
21+ specinfra (0.5.4 )
22+
23+ PLATFORMS
24+ ruby
25+
26+ DEPENDENCIES
27+ rake
28+ rspec
29+ serverspec
Original file line number Diff line number Diff line change 1+ require 'rake'
2+ require 'rspec/core/rake_task'
3+
4+ RSpec ::Core ::RakeTask . new ( :spec ) do |t |
5+ t . pattern = 'spec/*/*_spec.rb'
6+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe port ( 80 ) do
4+ it { should be_listening }
5+ end
6+
7+ describe file ( '/opt/neo4j/neo4j-community-2.0.0' ) do
8+ it { should be_directory }
9+ end
Original file line number Diff line number Diff line change 1+ require 'serverspec'
2+ require 'pathname'
3+ require 'net/ssh'
4+
5+ include SpecInfra ::Helper ::Ssh
6+ include SpecInfra ::Helper ::DetectOS
7+
8+ RSpec . configure do |c |
9+ if ENV [ 'ASK_SUDO_PASSWORD' ]
10+ require 'highline/import'
11+ c . sudo_password = ask ( "Enter sudo password: " ) { |q | q . echo = false }
12+ else
13+ c . sudo_password = ENV [ 'SUDO_PASSWORD' ]
14+ end
15+ c . before :all do
16+ block = self . class . metadata [ :example_group_block ]
17+ if RUBY_VERSION . start_with? ( '1.8' )
18+ file = block . to_s . match ( /.*@(.*):[0-9]+>/ ) [ 1 ]
19+ else
20+ file = block . source_location . first
21+ end
22+ host = File . basename ( Pathname . new ( file ) . dirname )
23+ if c . host != host
24+ c . ssh . close if c . ssh
25+ c . host = host
26+ options = Net ::SSH ::Config . for ( c . host )
27+ user = options [ :user ] || Etc . getlogin
28+ vagrant_up = `vagrant up `
29+ config = `vagrant ssh-config `
30+ if config != ''
31+ config . each_line do |line |
32+ if match = /HostName (.*)/ . match ( line )
33+ host = match [ 1 ]
34+ elsif match = /User (.*)/ . match ( line )
35+ user = match [ 1 ]
36+ elsif match = /IdentityFile (.*)/ . match ( line )
37+ options [ :keys ] = [ match [ 1 ] . gsub ( /"/ , '' ) ]
38+ elsif match = /Port (.*)/ . match ( line )
39+ options [ :port ] = match [ 1 ]
40+ end
41+ end
42+ end
43+ c . ssh = Net ::SSH . start ( host , user , options )
44+ end
45+ end
46+ end
You can’t perform that action at this time.
0 commit comments