capistrano-spec 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile.lock +24 -9
- data/Rakefile +1 -1
- data/capistrano-spec.gemspec +4 -4
- data/spec/capistrano-spec_spec.rb +15 -33
- data/spec/stub_commands_spec.rb +21 -18
- data/spec/uploaded_spec.rb +10 -8
- metadata +5 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTkzNTBlOGEzZjQyNzRlNDFmNTE4ODdmZjczZTA2MDAwY2E2N2EzYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzRkMzU0NjFiZjlhNzRiYTJjNGNjZjJiMjZhODhkMzU3OGIyZTQzZA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTE1ODc4YWM4NmIzM2E3ZTllZjUwZDQ0YWM3OTgxMmM1MjkxY2JiNWEyMjkw
|
10
|
+
YjVkZDQ5NDQ3OTI4MWY5MGVhOTU0YjcwNDBhN2YzN2I3Y2M3Y2JkMWE0Y2Nl
|
11
|
+
ZGMyOTQ5Y2Y2OTI4YjdkNzkxODE4ODg5NDVhNDZlNzlhNjZiZjY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTEzY2MwYjcwOTYwMTBlZTM5MWI1ZWYzYjJkNjhhZTliOGVmYjQzMGJhODMw
|
14
|
+
NmRiYmMwOTFiOGQ3MDA3OGI4OGQ1ZGZiMmNiOWQ4YzA3N2E4NzFhOGJjNmFj
|
15
|
+
YzFmNDAxM2JjNDJjNjhkYzEzNDIyNzZkYzYwOWY4MmNkOWFhMjg=
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,45 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
4
|
+
capistrano (2.14.2)
|
5
|
+
highline
|
6
|
+
net-scp (>= 1.0.0)
|
7
|
+
net-sftp (>= 2.0.0)
|
8
|
+
net-ssh (>= 2.0.14)
|
9
|
+
net-ssh-gateway (>= 1.1.0)
|
10
|
+
diff-lcs (1.2.3)
|
5
11
|
git (1.2.5)
|
12
|
+
highline (1.6.18)
|
6
13
|
jeweler (1.8.3)
|
7
14
|
bundler (~> 1.0)
|
8
15
|
git (>= 1.2.5)
|
9
16
|
rake
|
10
17
|
rdoc
|
11
18
|
json (1.6.6)
|
19
|
+
net-scp (1.1.0)
|
20
|
+
net-ssh (>= 2.6.5)
|
21
|
+
net-sftp (2.1.1)
|
22
|
+
net-ssh (>= 2.6.5)
|
23
|
+
net-ssh (2.6.7)
|
24
|
+
net-ssh-gateway (1.2.0)
|
25
|
+
net-ssh (>= 2.6.5)
|
12
26
|
rake (0.9.2.2)
|
13
27
|
rdoc (3.12)
|
14
28
|
json (~> 1.4)
|
15
|
-
rspec (2.
|
16
|
-
rspec-core (~> 2.
|
17
|
-
rspec-expectations (~> 2.
|
18
|
-
rspec-mocks (~> 2.
|
19
|
-
rspec-core (2.
|
20
|
-
rspec-expectations (2.
|
21
|
-
diff-lcs (
|
22
|
-
rspec-mocks (2.
|
29
|
+
rspec (2.13.0)
|
30
|
+
rspec-core (~> 2.13.0)
|
31
|
+
rspec-expectations (~> 2.13.0)
|
32
|
+
rspec-mocks (~> 2.13.0)
|
33
|
+
rspec-core (2.13.1)
|
34
|
+
rspec-expectations (2.13.0)
|
35
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
36
|
+
rspec-mocks (2.13.1)
|
23
37
|
|
24
38
|
PLATFORMS
|
25
39
|
ruby
|
26
40
|
|
27
41
|
DEPENDENCIES
|
42
|
+
capistrano
|
28
43
|
jeweler
|
29
44
|
rake
|
30
45
|
rspec
|
data/Rakefile
CHANGED
data/capistrano-spec.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "capistrano-spec"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Nichols", "Karl Matthias", "Peter M Souter", "Jan Graichen"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-22"
|
13
13
|
s.description = "Helpers and matchers for testing capistrano"
|
14
14
|
s.email = "josh@technicalpickles.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -36,11 +36,11 @@ Gem::Specification.new do |s|
|
|
36
36
|
]
|
37
37
|
s.homepage = "http://github.com/technicalpickles/capistrano-spec"
|
38
38
|
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = "
|
39
|
+
s.rubygems_version = "2.0.3"
|
40
40
|
s.summary = "Test your capistrano recipes"
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
43
|
-
s.specification_version =
|
43
|
+
s.specification_version = 4
|
44
44
|
|
45
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
46
|
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
@@ -12,36 +12,18 @@ describe Capistrano::Spec do
|
|
12
12
|
Capistrano::Fakerecipe.load_into(@configuration)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
before do
|
18
|
-
foo = double(foo)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "has a #callback matcher" do
|
22
|
-
expect{@configuration.should callback(foo)}.to_not raise_error(NoMethodError)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "has a #have_uploaded matcher" do
|
26
|
-
expect{@configuration.should have_uploaded(foo)}.to_not raise_error(NoMethodError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "has a #have_run matcher" do
|
30
|
-
expect{@configuration.should have_run(foo)}.to_not raise_error(NoMethodError)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
15
|
+
subject(:fake_recipe) { @configuration }
|
34
16
|
|
35
17
|
describe 'have_run' do
|
36
18
|
|
37
19
|
it "will not raise error when run is in recipe" do
|
38
|
-
|
39
|
-
expect{
|
20
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
21
|
+
expect{ should have_run("do some stuff")}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to run .*\s*, but did not/)
|
40
22
|
end
|
41
23
|
|
42
24
|
it "will raise error when run not in recipe" do
|
43
|
-
|
44
|
-
expect{
|
25
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
26
|
+
expect{ should have_run("don't find me")}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to run .*\s*, but did not/)
|
45
27
|
end
|
46
28
|
|
47
29
|
end
|
@@ -49,36 +31,36 @@ describe Capistrano::Spec do
|
|
49
31
|
describe 'have_uploaded' do
|
50
32
|
|
51
33
|
it "will not raise error when upload is in recipe" do
|
52
|
-
|
53
|
-
expect{
|
34
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
35
|
+
expect{ should have_uploaded('foo').to('/tmp/foo')}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to upload .*\s* to .*\s* but did not/)
|
54
36
|
end
|
55
37
|
|
56
38
|
it "will raise error when run upload not in recipe" do
|
57
|
-
|
58
|
-
expect{
|
39
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
40
|
+
expect{ should have_uploaded('bar').to('/tmp/bar')}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to upload .*\s* to .*\s* but did not/)
|
59
41
|
end
|
60
42
|
end
|
61
43
|
|
62
44
|
describe 'have_gotten' do
|
63
45
|
it "will not raise error when get is in recipe" do
|
64
|
-
|
65
|
-
expect{
|
46
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
47
|
+
expect{ should have_gotten('/tmp/baz').to('baz')}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to get .*\s* to .*\s* but did not/)
|
66
48
|
end
|
67
49
|
|
68
50
|
it "will raise error when get not in recipe" do
|
69
|
-
|
70
|
-
expect{
|
51
|
+
fake_recipe.find_and_execute_task('fake:thing')
|
52
|
+
expect{ should have_gotten('/tmp/blegga').to('blegga')}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to get .*\s* to .*\s* but did not/)
|
71
53
|
end
|
72
54
|
end
|
73
55
|
|
74
56
|
describe 'callback' do
|
75
57
|
|
76
58
|
it "will not raise error when `before` callback has occured" do
|
77
|
-
expect{
|
59
|
+
expect{ should callback('fake:thing').before('fake:stuff_and_things')}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to callback .*\s* before .*\s*, but did not/)
|
78
60
|
end
|
79
61
|
|
80
62
|
it "will not raise error when `after` callback has occured" do
|
81
|
-
expect{
|
63
|
+
expect{ should callback('fake:other_thing').after('fake:thing')}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to callback .*\s* after .*\s*, but did not/)
|
82
64
|
end
|
83
65
|
end
|
84
66
|
|
data/spec/stub_commands_spec.rb
CHANGED
@@ -27,50 +27,53 @@ describe 'Command stubbing' do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
subject(:configuration) { @configuration }
|
31
|
+
|
30
32
|
it 'should allow to stub command output' do
|
31
|
-
|
32
|
-
|
33
|
+
configuration.stub_command 'pwd', :data => '/stubded/path'
|
34
|
+
expect { remote_pwd.should == '/stubded/path' }
|
33
35
|
end
|
34
36
|
|
35
37
|
it 'should allow to stub sudo command output' do
|
36
|
-
|
37
|
-
|
38
|
+
configuration.stub_command "sudo -p 'sudo password: ' pwd", :data => '/stubbed/path'
|
39
|
+
expect { remote_sudo_pwd.should == '/stubbed/path' }
|
38
40
|
end
|
39
41
|
|
40
42
|
it 'should allow to stub custom command output' do
|
41
|
-
|
42
|
-
|
43
|
+
configuration.stub_command 'pwd', :data => '/stubbed/path'
|
44
|
+
expect { custom_pwd.should == 'out: /stubbed/path' }
|
43
45
|
end
|
44
46
|
|
45
47
|
it 'should allow to stub stream' do
|
46
|
-
|
47
|
-
|
48
|
+
configuration.stub_command 'pwd', :data => '/stubbed/path', :stream => :err
|
49
|
+
expect { custom_pwd.should == 'err: /stubbed/path' }
|
48
50
|
end
|
49
51
|
|
50
52
|
it 'should allow to stub commands without block' do
|
51
|
-
|
53
|
+
configuration.stub_command 'pwd'
|
52
54
|
expect { @configuration.no_block }.to_not raise_error(NoMethodError)
|
53
55
|
end
|
54
56
|
|
55
57
|
it 'should allow to stub command processing' do
|
56
|
-
|
57
|
-
|
58
|
+
configuration.stub_command 'pwd', :with => proc { |cmd| cmd }
|
59
|
+
expect { remote_pwd.should == 'pwd' }
|
58
60
|
end
|
59
61
|
|
62
|
+
let(:testvar) { false }
|
63
|
+
|
60
64
|
it 'should allow to stub command processing (2)' do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
testvar.should be_true
|
65
|
+
configuration.stub_command 'pwd' do |cmd| testvar = true end
|
66
|
+
configuration.no_block
|
67
|
+
expect { testvar.should be_true}
|
65
68
|
end
|
66
69
|
|
67
70
|
it 'should allow to stub command processing with error' do
|
68
|
-
|
71
|
+
configuration.stub_command 'pwd', :raise => ::Capistrano::CommandError
|
69
72
|
expect { @configuration.no_block }.to raise_error(::Capistrano::CommandError)
|
70
73
|
end
|
71
74
|
|
72
75
|
it 'should allow to stub command processing with CommandError' do
|
73
|
-
|
74
|
-
expect {
|
76
|
+
configuration.stub_command 'pwd', :fail => true
|
77
|
+
expect { configuration.no_block }.to raise_error(::Capistrano::CommandError)
|
75
78
|
end
|
76
79
|
end
|
data/spec/uploaded_spec.rb
CHANGED
@@ -22,23 +22,25 @@ describe 'Capistrano has uploaded' do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
subject(:configuration) { @configuration }
|
26
|
+
|
25
27
|
it 'some file' do
|
26
|
-
|
27
|
-
|
28
|
+
configuration.upload 'source.file', 'target.file'
|
29
|
+
expect{ should have_uploaded }
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'a specific file to a specific location' do
|
31
|
-
|
32
|
-
|
33
|
+
configuration.upload_from_to
|
34
|
+
expect{ should have_uploaded('source.file').to('target.file') }
|
33
35
|
end
|
34
36
|
|
35
37
|
it 'a specific file to some location' do
|
36
|
-
|
37
|
-
|
38
|
+
configuration.upload_from
|
39
|
+
expect{ should have_uploaded('source.file') }
|
38
40
|
end
|
39
41
|
|
40
42
|
it 'some file to a specific location' do
|
41
|
-
|
42
|
-
|
43
|
+
configuration.upload_to
|
44
|
+
expect{ should have_uploaded.to('target.file') }
|
43
45
|
end
|
44
46
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Joshua Nichols
|
@@ -12,12 +11,11 @@ authors:
|
|
12
11
|
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain: []
|
15
|
-
date: 2013-04-
|
14
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
18
17
|
name: rspec
|
19
18
|
requirement: !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
19
|
requirements:
|
22
20
|
- - ! '>='
|
23
21
|
- !ruby/object:Gem::Version
|
@@ -25,7 +23,6 @@ dependencies:
|
|
25
23
|
type: :development
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
27
|
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
@@ -56,26 +53,25 @@ files:
|
|
56
53
|
- spec/uploaded_spec.rb
|
57
54
|
homepage: http://github.com/technicalpickles/capistrano-spec
|
58
55
|
licenses: []
|
56
|
+
metadata: {}
|
59
57
|
post_install_message:
|
60
58
|
rdoc_options: []
|
61
59
|
require_paths:
|
62
60
|
- lib
|
63
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
62
|
requirements:
|
66
63
|
- - ! '>='
|
67
64
|
- !ruby/object:Gem::Version
|
68
65
|
version: '0'
|
69
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
67
|
requirements:
|
72
68
|
- - ! '>='
|
73
69
|
- !ruby/object:Gem::Version
|
74
70
|
version: '0'
|
75
71
|
requirements: []
|
76
72
|
rubyforge_project:
|
77
|
-
rubygems_version:
|
73
|
+
rubygems_version: 2.0.3
|
78
74
|
signing_key:
|
79
|
-
specification_version:
|
75
|
+
specification_version: 4
|
80
76
|
summary: Test your capistrano recipes
|
81
77
|
test_files: []
|