capistrano-spec 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,28 +1,14 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
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
4
  diff-lcs (1.1.3)
11
5
  git (1.2.5)
12
- highline (1.6.16)
13
6
  jeweler (1.8.3)
14
7
  bundler (~> 1.0)
15
8
  git (>= 1.2.5)
16
9
  rake
17
10
  rdoc
18
11
  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.6)
24
- net-ssh-gateway (1.2.0)
25
- net-ssh (>= 2.6.5)
26
12
  rake (0.9.2.2)
27
13
  rdoc (3.12)
28
14
  json (~> 1.4)
@@ -39,7 +25,6 @@ PLATFORMS
39
25
  ruby
40
26
 
41
27
  DEPENDENCIES
42
- capistrano
43
28
  jeweler
44
29
  rake
45
30
  rspec
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "capistrano-spec"
8
- gem.version = '0.3.0'
8
+ gem.version = '0.3.1'
9
9
 
10
10
  gem.summary = %Q{Test your capistrano recipes}
11
11
  gem.description = %Q{Helpers and matchers for testing capistrano}
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-spec"
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
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-07"
12
+ s.date = "2013-04-10"
13
13
  s.description = "Helpers and matchers for testing capistrano"
14
14
  s.email = "josh@technicalpickles.com"
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "lib/capistrano-spec.rb",
28
28
  "lib/capistrano/spec.rb",
29
29
  "spec/capistrano-spec_spec.rb",
30
+ "spec/recipe/fakerecipe.rb",
30
31
  "spec/spec.opts",
31
32
  "spec/spec_helper.rb",
32
33
  "spec/stub_commands_spec.rb",
@@ -34,7 +35,7 @@ Gem::Specification.new do |s|
34
35
  ]
35
36
  s.homepage = "http://github.com/technicalpickles/capistrano-spec"
36
37
  s.require_paths = ["lib"]
37
- s.rubygems_version = "1.8.25"
38
+ s.rubygems_version = "1.8.23"
38
39
  s.summary = "Test your capistrano recipes"
39
40
 
40
41
  if s.respond_to? :specification_version then
@@ -1,7 +1,85 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
+ require 'capistrano'
3
+
4
+ require_relative 'recipe/FakeRecipe'
5
+
6
+ describe Capistrano::Spec do
7
+
8
+ before do
9
+ @configuration = Capistrano::Configuration.new
10
+ @configuration.extend(Capistrano::Spec::ConfigurationExtension)
11
+ @configuration.extend(Capistrano::FakeRecipe)
12
+ Capistrano::FakeRecipe.load_into(@configuration)
13
+ end
14
+
15
+ describe Capistrano::Spec::Matchers do
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
34
+
35
+ describe 'have_run' do
36
+
37
+ it "will not raise error when run is in recipe" do
38
+ @configuration.find_and_execute_task('fake:thing')
39
+ expect{@configuration.should have_run("do some stuff")}.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to run .*\s*, but did not/)
40
+ end
41
+
42
+ it "will raise error when run not in recipe" do
43
+ @configuration.find_and_execute_task('fake:thing')
44
+ expect{@configuration.should have_run("don't find me")}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to run .*\s*, but did not/)
45
+ end
2
46
 
3
- describe "CapistranoSpec" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
47
  end
48
+
49
+ describe 'have_uploaded' do
50
+
51
+ it "will not raise error when upload is in recipe" do
52
+ @configuration.find_and_execute_task('fake:thing')
53
+ expect{@configuration.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
+ end
55
+
56
+ it "will raise error when run upload not in recipe" do
57
+ @configuration.find_and_execute_task('fake:thing')
58
+ expect{@configuration.should have_uploaded('bar').to('/tmp/bar')}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to upload .*\s* to .*\s* but did not/)
59
+ end
60
+ end
61
+
62
+ describe 'have_gotten' do
63
+ it "will not raise error when get is in recipe" do
64
+ @configuration.find_and_execute_task('fake:thing')
65
+ expect{@configuration.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
+ end
67
+
68
+ it "will raise error when get not in recipe" do
69
+ @configuration.find_and_execute_task('fake:thing')
70
+ expect{@configuration.should have_gotten('/tmp/blegga').to('blegga')}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to get .*\s* to .*\s* but did not/)
71
+ end
72
+ end
73
+
74
+ describe 'callback' do
75
+
76
+ it "will not raise error when `before` callback has occured" do
77
+ expect{@configuration.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
+ end
79
+
80
+ it "will not raise error when `after` callback has occured" do
81
+ expect{@configuration.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
+ end
83
+ end
84
+
7
85
  end
@@ -0,0 +1,32 @@
1
+ require 'capistrano'
2
+ module Capistrano
3
+ module FakeRecipe
4
+ def self.load_into(configuration)
5
+ configuration.load do
6
+ before "fake:stuff_and_things", "fake:thing"
7
+ after "fake:thing", "fake:other_thing"
8
+ namespace :fake do
9
+ desc "thing and run fake manifests"
10
+ task :thing do
11
+ set :bar, "baz"
12
+ run('do some stuff')
13
+ upload("foo", "/tmp/foo")
14
+ get('/tmp/baz', 'baz')
15
+ end
16
+ desc "More fake tasks!"
17
+ task :other_thing do
18
+ #
19
+ end
20
+ desc "You get the picture..."
21
+ task :stuff_and_things do
22
+ #
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ if Capistrano::Configuration.instance
31
+ Capistrano::FakeRecipe.load_into(Capistrano::Configuration.instance)
32
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'capistrano'
3
4
  require 'capistrano-spec'
4
5
  require 'rspec'
5
6
  require 'rspec/autorun'
6
7
 
7
8
  RSpec.configure do |config|
8
-
9
+ config.include Capistrano::Spec::Matchers
10
+ config.include Capistrano::Spec::Helpers
9
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-04-07 00:00:00.000000000 Z
15
+ date: 2013-04-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -48,6 +48,7 @@ files:
48
48
  - lib/capistrano-spec.rb
49
49
  - lib/capistrano/spec.rb
50
50
  - spec/capistrano-spec_spec.rb
51
+ - spec/recipe/fakerecipe.rb
51
52
  - spec/spec.opts
52
53
  - spec/spec_helper.rb
53
54
  - spec/stub_commands_spec.rb
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  version: '0'
73
74
  requirements: []
74
75
  rubyforge_project:
75
- rubygems_version: 1.8.25
76
+ rubygems_version: 1.8.23
76
77
  signing_key:
77
78
  specification_version: 3
78
79
  summary: Test your capistrano recipes