capistrano-spec 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -0
- data/Rakefile +1 -1
- data/capistrano-spec.gemspec +9 -9
- data/lib/capistrano/spec.rb +50 -0
- data/spec/capistrano-spec_spec.rb +34 -0
- data/spec/recipe/fakerecipe.rb +2 -1
- metadata +57 -33
- checksums.yaml +0 -15
    
        data/README.rdoc
    CHANGED
    
    | @@ -126,6 +126,11 @@ One thing you might be wondering now is... that's cool, but what about working w | |
| 126 126 | 
             
                @configuration.should have_gotten('/tmp/bar').to('bar')
         | 
| 127 127 | 
             
              end
         | 
| 128 128 |  | 
| 129 | 
            +
              it "should have put" do
         | 
| 130 | 
            +
                @configuration.put 'some: content', '/config.yml'
         | 
| 131 | 
            +
                @configuration.should have_put('some: content').to('/config.yml')
         | 
| 132 | 
            +
              end
         | 
| 133 | 
            +
             | 
| 129 134 | 
             
            You also test [callbacks](http://rubydoc.info/github/capistrano/capistrano/master/Capistrano/Configuration/Callbacks) to see if your tasks are being called at the right time:
         | 
| 130 135 |  | 
| 131 136 | 
             
              require 'capistrano'
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/capistrano-spec.gemspec
    CHANGED
    
    | @@ -4,14 +4,14 @@ | |
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 | 
            -
              s.name =  | 
| 8 | 
            -
              s.version = "0. | 
| 7 | 
            +
              s.name = %q{capistrano-spec}
         | 
| 8 | 
            +
              s.version = "0.5.0"
         | 
| 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 =  | 
| 13 | 
            -
              s.description =  | 
| 14 | 
            -
              s.email =  | 
| 12 | 
            +
              s.date = %q{2013-06-21}
         | 
| 13 | 
            +
              s.description = %q{Helpers and matchers for testing capistrano}
         | 
| 14 | 
            +
              s.email = %q{josh@technicalpickles.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| 16 16 | 
             
                "LICENSE",
         | 
| 17 17 | 
             
                "README.rdoc"
         | 
| @@ -34,13 +34,13 @@ Gem::Specification.new do |s| | |
| 34 34 | 
             
                "spec/stub_commands_spec.rb",
         | 
| 35 35 | 
             
                "spec/uploaded_spec.rb"
         | 
| 36 36 | 
             
              ]
         | 
| 37 | 
            -
              s.homepage =  | 
| 37 | 
            +
              s.homepage = %q{http://github.com/technicalpickles/capistrano-spec}
         | 
| 38 38 | 
             
              s.require_paths = ["lib"]
         | 
| 39 | 
            -
              s.rubygems_version =  | 
| 40 | 
            -
              s.summary =  | 
| 39 | 
            +
              s.rubygems_version = %q{1.6.2}
         | 
| 40 | 
            +
              s.summary = %q{Test your capistrano recipes}
         | 
| 41 41 |  | 
| 42 42 | 
             
              if s.respond_to? :specification_version then
         | 
| 43 | 
            -
                s.specification_version =  | 
| 43 | 
            +
                s.specification_version = 3
         | 
| 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"])
         | 
    
        data/lib/capistrano/spec.rb
    CHANGED
    
    | @@ -176,6 +176,56 @@ module Capistrano | |
| 176 176 |  | 
| 177 177 | 
             
                  end
         | 
| 178 178 |  | 
| 179 | 
            +
                  define :have_put do |content|
         | 
| 180 | 
            +
                    @to = nil
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                    match do |configuration|
         | 
| 183 | 
            +
                      uploads = configuration.uploads.reduce([]) do |memo, (upload, options)|
         | 
| 184 | 
            +
                        # the {#put} method creates a {StringIO} object.
         | 
| 185 | 
            +
                        # @see {StringIO#string}
         | 
| 186 | 
            +
                        if upload.respond_to?(:string) && upload.string == content
         | 
| 187 | 
            +
                          memo << options
         | 
| 188 | 
            +
                        end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                        memo
         | 
| 191 | 
            +
                      end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                      if @to
         | 
| 194 | 
            +
                        uploads.any? { |upload| upload[:to] == @to }
         | 
| 195 | 
            +
                      else
         | 
| 196 | 
            +
                        !uploads.empty?
         | 
| 197 | 
            +
                      end
         | 
| 198 | 
            +
                    end
         | 
| 199 | 
            +
             | 
| 200 | 
            +
                    def to(path)
         | 
| 201 | 
            +
                      @to = path
         | 
| 202 | 
            +
                      self
         | 
| 203 | 
            +
                    end
         | 
| 204 | 
            +
             | 
| 205 | 
            +
                    failure_message_for_should do |configuration|
         | 
| 206 | 
            +
                      if @to
         | 
| 207 | 
            +
                        "expected configuration to put #{content.inspect} to #{@to.inspect}, but did not"
         | 
| 208 | 
            +
                      else
         | 
| 209 | 
            +
                        "expected configuration to put #{content.inspect}, but did not"
         | 
| 210 | 
            +
                      end
         | 
| 211 | 
            +
                    end
         | 
| 212 | 
            +
             | 
| 213 | 
            +
                    failure_message_for_should_not do |configuration|
         | 
| 214 | 
            +
                      if @to
         | 
| 215 | 
            +
                        "expected configuration to not put #{content.inspect} to #{@to.inspect}, but did"
         | 
| 216 | 
            +
                      else
         | 
| 217 | 
            +
                        "expected configuration to not put #{content.inspect}, but did"
         | 
| 218 | 
            +
                      end
         | 
| 219 | 
            +
                    end
         | 
| 220 | 
            +
             | 
| 221 | 
            +
                    description do
         | 
| 222 | 
            +
                      if @to
         | 
| 223 | 
            +
                        "puts the content #{content.inspect} to #{@to.inspect}"
         | 
| 224 | 
            +
                      else
         | 
| 225 | 
            +
                        "puts the content #{content.inspect}"
         | 
| 226 | 
            +
                      end
         | 
| 227 | 
            +
                    end
         | 
| 228 | 
            +
                  end
         | 
| 179 229 | 
             
                end
         | 
| 180 230 | 
             
              end
         | 
| 181 231 | 
             
            end
         | 
| @@ -67,4 +67,38 @@ describe Capistrano::Spec do | |
| 67 67 | 
             
                end
         | 
| 68 68 | 
             
              end
         | 
| 69 69 |  | 
| 70 | 
            +
              describe 'have_put' do
         | 
| 71 | 
            +
                context 'when a path is given' do
         | 
| 72 | 
            +
                  it "will not raise error when put is in recipe" do
         | 
| 73 | 
            +
                    fake_recipe.find_and_execute_task('fake:thing')
         | 
| 74 | 
            +
                    expect do
         | 
| 75 | 
            +
                      should have_put('fake content').to('/tmp/put')
         | 
| 76 | 
            +
                    end.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to put .*\s* to .*\s*, but did not/)
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  it "will raise error when put is not in recipe" do
         | 
| 80 | 
            +
                    fake_recipe.find_and_execute_task('fake:thing')
         | 
| 81 | 
            +
                    expect do
         | 
| 82 | 
            +
                      should have_put('real content').to('/tmp/wherever')
         | 
| 83 | 
            +
                    end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to put .*\s* to .*\s*, but did not/)
         | 
| 84 | 
            +
                  end
         | 
| 85 | 
            +
                end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                context 'when a path is not given' do
         | 
| 88 | 
            +
                  it "will not raise error when put is in recipe" do
         | 
| 89 | 
            +
                    fake_recipe.find_and_execute_task('fake:thing')
         | 
| 90 | 
            +
                    expect do
         | 
| 91 | 
            +
                      should have_put('fake content')
         | 
| 92 | 
            +
                    end.to_not raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to put .*\s*, but did not/)
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  it "will raise error when put is not in recipe" do
         | 
| 96 | 
            +
                    fake_recipe.find_and_execute_task('fake:thing')
         | 
| 97 | 
            +
                    expect do
         | 
| 98 | 
            +
                      should have_put('real content')
         | 
| 99 | 
            +
                    end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected configuration to put .*\s*, but did not/)
         | 
| 100 | 
            +
                  end
         | 
| 101 | 
            +
                end
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 70 104 | 
             
            end
         | 
    
        data/spec/recipe/fakerecipe.rb
    CHANGED
    
    | @@ -14,6 +14,7 @@ require 'capistrano' | |
| 14 14 | 
             
                          run('do some stuff')
         | 
| 15 15 | 
             
                          upload("foo", "/tmp/foo")
         | 
| 16 16 | 
             
                          get('/tmp/baz', 'baz')
         | 
| 17 | 
            +
                          put('fake content', '/tmp/put')
         | 
| 17 18 | 
             
                        end
         | 
| 18 19 | 
             
                        desc "More fake tasks!"
         | 
| 19 20 | 
             
                        task :before_this_execute_thing do
         | 
| @@ -37,4 +38,4 @@ require 'capistrano' | |
| 37 38 |  | 
| 38 39 | 
             
              if Capistrano::Configuration.instance
         | 
| 39 40 | 
             
                Capistrano::FakeRecipe.load_into(Capistrano::Configuration.instance)
         | 
| 40 | 
            -
              end
         | 
| 41 | 
            +
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,9 +1,15 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification
         | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: capistrano-spec
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
               | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 11
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 5
         | 
| 9 | 
            +
              - 0
         | 
| 10 | 
            +
              version: 0.5.0
         | 
| 5 11 | 
             
            platform: ruby
         | 
| 6 | 
            -
            authors:
         | 
| 12 | 
            +
            authors: 
         | 
| 7 13 | 
             
            - Joshua Nichols
         | 
| 8 14 | 
             
            - Karl Matthias
         | 
| 9 15 | 
             
            - Peter M Souter
         | 
| @@ -11,30 +17,36 @@ authors: | |
| 11 17 | 
             
            autorequire: 
         | 
| 12 18 | 
             
            bindir: bin
         | 
| 13 19 | 
             
            cert_chain: []
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
                 | 
| 21 | 
            -
             | 
| 20 | 
            +
             | 
| 21 | 
            +
            date: 2013-06-21 00:00:00 +02:00
         | 
| 22 | 
            +
            default_executable: 
         | 
| 23 | 
            +
            dependencies: 
         | 
| 24 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 25 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 26 | 
            +
                none: false
         | 
| 27 | 
            +
                requirements: 
         | 
| 28 | 
            +
                - - ">="
         | 
| 29 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 30 | 
            +
                    hash: 15
         | 
| 31 | 
            +
                    segments: 
         | 
| 32 | 
            +
                    - 2
         | 
| 33 | 
            +
                    - 0
         | 
| 34 | 
            +
                    - 0
         | 
| 22 35 | 
             
                    version: 2.0.0
         | 
| 23 36 | 
             
              type: :development
         | 
| 37 | 
            +
              name: rspec
         | 
| 38 | 
            +
              version_requirements: *id001
         | 
| 24 39 | 
             
              prerelease: false
         | 
| 25 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 | 
            -
                requirements:
         | 
| 27 | 
            -
                - - ! '>='
         | 
| 28 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: 2.0.0
         | 
| 30 40 | 
             
            description: Helpers and matchers for testing capistrano
         | 
| 31 41 | 
             
            email: josh@technicalpickles.com
         | 
| 32 42 | 
             
            executables: []
         | 
| 43 | 
            +
             | 
| 33 44 | 
             
            extensions: []
         | 
| 34 | 
            -
             | 
| 45 | 
            +
             | 
| 46 | 
            +
            extra_rdoc_files: 
         | 
| 35 47 | 
             
            - LICENSE
         | 
| 36 48 | 
             
            - README.rdoc
         | 
| 37 | 
            -
            files:
         | 
| 49 | 
            +
            files: 
         | 
| 38 50 | 
             
            - .document
         | 
| 39 51 | 
             
            - .travis.yml
         | 
| 40 52 | 
             
            - Gemfile
         | 
| @@ -51,27 +63,39 @@ files: | |
| 51 63 | 
             
            - spec/spec_helper.rb
         | 
| 52 64 | 
             
            - spec/stub_commands_spec.rb
         | 
| 53 65 | 
             
            - spec/uploaded_spec.rb
         | 
| 66 | 
            +
            has_rdoc: true
         | 
| 54 67 | 
             
            homepage: http://github.com/technicalpickles/capistrano-spec
         | 
| 55 68 | 
             
            licenses: []
         | 
| 56 | 
            -
             | 
| 69 | 
            +
             | 
| 57 70 | 
             
            post_install_message: 
         | 
| 58 71 | 
             
            rdoc_options: []
         | 
| 59 | 
            -
             | 
| 72 | 
            +
             | 
| 73 | 
            +
            require_paths: 
         | 
| 60 74 | 
             
            - lib
         | 
| 61 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 62 | 
            -
               | 
| 63 | 
            -
               | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 75 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 76 | 
            +
              none: false
         | 
| 77 | 
            +
              requirements: 
         | 
| 78 | 
            +
              - - ">="
         | 
| 79 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 80 | 
            +
                  hash: 3
         | 
| 81 | 
            +
                  segments: 
         | 
| 82 | 
            +
                  - 0
         | 
| 83 | 
            +
                  version: "0"
         | 
| 84 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 85 | 
            +
              none: false
         | 
| 86 | 
            +
              requirements: 
         | 
| 87 | 
            +
              - - ">="
         | 
| 88 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 89 | 
            +
                  hash: 3
         | 
| 90 | 
            +
                  segments: 
         | 
| 91 | 
            +
                  - 0
         | 
| 92 | 
            +
                  version: "0"
         | 
| 71 93 | 
             
            requirements: []
         | 
| 94 | 
            +
             | 
| 72 95 | 
             
            rubyforge_project: 
         | 
| 73 | 
            -
            rubygems_version:  | 
| 96 | 
            +
            rubygems_version: 1.6.2
         | 
| 74 97 | 
             
            signing_key: 
         | 
| 75 | 
            -
            specification_version:  | 
| 98 | 
            +
            specification_version: 3
         | 
| 76 99 | 
             
            summary: Test your capistrano recipes
         | 
| 77 100 | 
             
            test_files: []
         | 
| 101 | 
            +
             | 
    
        checksums.yaml
    DELETED
    
    | @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            ---
         | 
| 2 | 
            -
            !binary "U0hBMQ==":
         | 
| 3 | 
            -
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                NDU4NmVlNjQyZWFhYTZkMWIwYjMwMmQxMGI4ZGYzMGVkOWI1Y2U1Ng==
         | 
| 5 | 
            -
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                ZTM0Y2VhYTdkMWVlZTZkYTgxZDE3YWM3MzIxNWNmMjUyZmRkNWFjZQ==
         | 
| 7 | 
            -
            !binary "U0hBNTEy":
         | 
| 8 | 
            -
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                OGZlNjE2YzJhODU0NmZiZDFlMjg3MmMxNjdhYWZkZjM2MzMxODBlMzlhMmYz
         | 
| 10 | 
            -
                MDRjMjE3NzlhOTIyZjVkYmM3NWY4NTIwZWYxMDU3OWJiMTk3NzVkNThlNjA5
         | 
| 11 | 
            -
                ZDNmN2M5ZmVkZmU2ODdlNGNiNWY0OTVjNDU0ODQ1ZTU0ZjQ5ZDQ=
         | 
| 12 | 
            -
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                NzQzMDVhNjhiNDUyOTQ3YzM0YjM5NDdiY2E4ZDY2MWZhM2ZjMDA5NWRkMzU0
         | 
| 14 | 
            -
                NmIzZmM0YThiNTI1NDgyNzE1MWQ2YTMyYzhjY2ExZGNiMDlhOGFiMmNlM2Fj
         | 
| 15 | 
            -
                MDg1ZGY0MzUyY2IxMjFjMTEyMDkyNzk5NGExMzVhYmE4YWExYzk=
         |