Sha256: 8e08f855f07ca20d930d03c8bdcafacc93be738658e71284ee7c0530b68d388c

Contents?: true

Size: 1.83 KB

Versions: 4

Compression:

Stored size: 1.83 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

describe ChefCapConfiguration do
  describe ".set_repository_settings" do
    context "the repository specific settings" do
      before do
        ENV["rev"] = "SOME_REV"
      end

      it "should set repository values for a git repository" do
        configuration = mock("Configuration")
        configuration.stub!(:repository => "git@somegitrepo")
        configuration.should_receive(:set).with(:scm, :git)
        configuration.should_receive(:set).with(:git_enable_submodules, 1)
        configuration.should_receive(:default_run_options).and_return({})
        configuration.should_receive(:depend).with(:remote, :command, "git")
        configuration.should_receive(:set).with(:revision, anything)
        ChefCapConfiguration.configuration = configuration

        ChefCapConfiguration.set_repository_settings
      end

      it "should set repository values for an svn repository" do
        configuration = mock("Configuration")
        ChefCapConfiguration.configuration = configuration
        configuration.stub!(:repository => "svn://somesvnrepo")
        configuration.should_receive(:set).with(:scm, :svn)
        configuration.should_receive(:depend).with(:remote, :command, "svn")
        configuration.should_receive(:set).with(:revision, anything)

        ChefCapConfiguration.set_repository_settings
      end
    end

    it "should set the revision variable so other capistrano tasks will have the right revision value" do
      configuration = mock("Configuration")
      ChefCapConfiguration.configuration = configuration
      configuration.stub!(:repository => nil)
      ENV["rev"] = "SOME_REV"
      configuration.should_receive(:set).with(:revision, "SOME_REV")

      ChefCapConfiguration.set_repository_settings
      ENV["rev"] = nil
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chef_cap-0.3.1 spec/chef_cap_configuration_spec.rb
chef_cap-0.3.0 spec/chef_cap_configuration_spec.rb
chef_cap-0.2.9 spec/chef_cap_configuration_spec.rb
chef_cap-0.2.8 spec/chef_cap_configuration_spec.rb