diff --git a/spec/fixtures/bzr_version_info.txt b/spec/fixtures/bzr_version_info.txt deleted file mode 100644 index 88a56a1..0000000 --- a/spec/fixtures/bzr_version_info.txt +++ /dev/null @@ -1,5 +0,0 @@ -revision-id: menesis@pov.lt-20100309191856-4wmfqzc803fj300x -date: 2010-03-09 21:18:56 +0200 -build-date: 2010-03-14 00:42:43 -0800 -revno: 2634 -branch-nick: mytest diff --git a/spec/fixtures/git_branch_a.txt b/spec/fixtures/git_branch_a.txt deleted file mode 100644 index 2c99829..0000000 --- a/spec/fixtures/git_branch_a.txt +++ /dev/null @@ -1,14 +0,0 @@ - feature/foo - feature/bar - feature/baz - feature/quux - only/local -* master - refactor/foo - origin/HEAD - origin/feature/foo - origin/feature/bar - origin/feature/baz - origin/feature/quux - origin/only/remote - origin/master diff --git a/spec/fixtures/hg_parents.txt b/spec/fixtures/hg_parents.txt deleted file mode 100644 index 46173df..0000000 --- a/spec/fixtures/hg_parents.txt +++ /dev/null @@ -1,6 +0,0 @@ -changeset: 3:34e6012c783a -parent: 2:21ea4598c962 -parent: 1:9d0ff0028458 -user: Test User -date: Fri Aug 07 13:13:02 2009 -0400 -summary: merge diff --git a/spec/fixtures/hg_tags.txt b/spec/fixtures/hg_tags.txt deleted file mode 100644 index 53792e5..0000000 --- a/spec/fixtures/hg_tags.txt +++ /dev/null @@ -1,18 +0,0 @@ -tip 1019:bca3f20b249b -0.9.1 1017:76ce7cca95d8 -0.9 1001:dbaa6f4ec585 -0.8 839:65b66ac0fc83 -0.7.1 702:e1357f00129f -0.7 561:7b2af3b4c968 -0.6.3 486:e38077f4e4aa -0.6.2 405:07bb099b7b10 -0.6.1 389:93750f3fbbe2 -0.6 369:34e6012c783a -0.5.3 321:5ffa6ae7e699 -0.5.2 318:fdc2c2e4cebe -0.5.1 315:33a5ea0cbe7a -0.5 313:47490716f4c9 -0.4 240:47fa3a14cc63 -0.3.1 132:bc231db18e1c -0.3 130:661615e510dd -0.2 81:f98d13b442f6 diff --git a/spec/fixtures/svn_info.txt b/spec/fixtures/svn_info.txt deleted file mode 100644 index d2a975b..0000000 --- a/spec/fixtures/svn_info.txt +++ /dev/null @@ -1,10 +0,0 @@ -Path: . -URL: http://example.com/svn/trunk -Repository Root: http://example.com/svn -Repository UUID: 75246ace-e253-0410-96dd-a7613ca8dc81 -Revision: 4 -Node Kind: directory -Schedule: normal -Last Changed Author: jon -Last Changed Rev: 3 -Last Changed Date: 2008-08-07 11:34:25 -0700 (Thu, 07 Aug 2008) diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 95e5d6e..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'pathname' -dir = Pathname.new(__FILE__).parent -$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib') - -require 'mocha' -require 'puppet' -gem 'rspec', '>= 1.2.9' -require 'spec/autorun' - -Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each do |support_file| - require support_file -end - -Spec::Runner.configure do |config| - config.mock_with :mocha - config.include(FixtureHelpers) - config.include(FilesystemHelpers) -end - -# We need this because the RAL uses 'should' as a method. This -# allows us the same behaviour but with a different method name. -class Object - alias :must :should -end diff --git a/spec/support/filesystem_helpers.rb b/spec/support/filesystem_helpers.rb deleted file mode 100644 index 08345b4..0000000 --- a/spec/support/filesystem_helpers.rb +++ /dev/null @@ -1,18 +0,0 @@ -module FilesystemHelpers - - def expects_chdir(path = resource.value(:path)) - Dir.expects(:chdir).with(path).at_least_once.yields - end - - def expects_mkdir(path = resource.value(:path)) - Dir.expects(:mkdir).with(path).at_least_once - end - - def expects_rm_rf(path = resource.value(:path)) - FileUtils.expects(:rm_rf).with(path) - end - - def expects_directory?(returns = true, path = resource.value(:path)) - File.expects(:directory?).with(path).returns(returns) - end -end diff --git a/spec/support/fixture_helpers.rb b/spec/support/fixture_helpers.rb deleted file mode 100644 index 7b7b20a..0000000 --- a/spec/support/fixture_helpers.rb +++ /dev/null @@ -1,7 +0,0 @@ -module FixtureHelpers - - def fixture(name, ext = '.txt') - File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', name.to_s + ext)) - end - -end diff --git a/spec/support/provider_example_group.rb b/spec/support/provider_example_group.rb deleted file mode 100644 index 2a8865f..0000000 --- a/spec/support/provider_example_group.rb +++ /dev/null @@ -1,80 +0,0 @@ -class ProviderExampleGroup < Spec::Example::ExampleGroup - - # Allow access to the current resource - attr_reader :resource - - # Build up the values for the resource in this scope - before :each do - resource_hash = example_group_hierarchy.inject({}) do |memo, klass| - memo.merge(klass.options[:resource] || {}) - end - full_hash = resource_hash.merge(:provider => described_class.name) - @resource = described_class.resource_type.new(full_hash) - end - - # Build the provider - subject { described_class.new(@resource) } - - # Allow access to it via +provider+ - alias :provider :subject - - # Generate a context for a provider operating on a resource with: - # - # call-seq: - # - # # A parameter/property set (when the value isn't important) - # resource_with :source do - # # ... - # end - # - # # A parameter/property set to a specific value - # resource_with :source => 'a-specific-value' do - # # ... - # end - # - # Note: Choose one or the other (mixing will create two separate contexts) - # - def self.resource_with(*params, &block) - params_with_values = params.last.is_a?(Hash) ? params.pop : {} - build_value_context(params_with_values, &block) - build_existence_context(*params, &block) - end - - def self.build_existence_context(*params, &block) #:nodoc: - unless params.empty? - text = params.join(', ') - placeholders = params.inject({}) { |memo, key| memo.merge(key => 'an-unimportant-value') } - context("and with a #{text}", {:resource => placeholders}, &block) - end - end - - def self.build_value_context(params = {}, &block) #:nodoc: - unless params.empty? - text = params.map { |k, v| "#{k} => #{v.inspect}" }.join(' and with ') - context("and with #{text}", {:resource => params}, &block) - end - end - - - # Generate a context for a provider operating on a resource without - # a given parameter/property. - # - # call-seq: - # - # resource_without :source do - # # ... - # end - # - def self.resource_without(field, &block) - context("and without a #{field}", &block) - end - -end - -Spec::Example::ExampleGroupFactory.register(:provider, ProviderExampleGroup) - -# Outside wrapper to lookup a provider and start the spec using ProviderExampleGroup -def describe_provider(type_name, provider_name, options = {}, &block) - provider_class = Puppet::Type.type(type_name).provider(provider_name) - describe(provider_class, options.merge(:type => :provider), &block) -end diff --git a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb deleted file mode 100644 index f073b8e..0000000 --- a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb +++ /dev/null @@ -1,90 +0,0 @@ -require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end } - -describe_provider :vcsrepo, :bzr, :resource => {:path => '/tmp/vcsrepo'} do - - describe 'creating' do - resource_with :source do - resource_with :revision do - it "should execute 'bzr clone -r' with the revision" do - provider.expects(:bzr).with('branch', '-r', resource.value(:revision), resource.value(:source), resource.value(:path)) - provider.create - end - end - resource_without :revision do - it "should just execute 'bzr clone' without a revision" do - provider.expects(:bzr).with('branch', resource.value(:source), resource.value(:path)) - provider.create - end - end - end - resource_without :source do - it "should execute 'bzr init'" do - provider.expects(:bzr).with('init', resource.value(:path)) - provider.create - end - end - end - - describe 'destroying' do - it "it should remove the directory" do - expects_rm_rf - provider.destroy - end - end - - describe "checking existence" do - it "should check for the directory" do - expects_directory?(true, File.join(resource.value(:path), '.bzr')) - provider.exists? - end - end - - describe "checking the revision property" do - before do - expects_chdir - provider.expects(:bzr).with('version-info').returns(fixture(:bzr_version_info)) - @current_revid = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x' - end - context "when given a non-revid as the resource revision", :resource => {:revision => '2634'} do - context "when its revid is not different than the current revid" do - before do - provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("#{resource.value(:revision)} menesis@pov.lt-20100309191856-4wmfqzc803fj300x\n") - end - it "should return the ref" do - provider.revision.should == resource.value(:revision) - end - end - context "when its revid is different than the current revid", :resource => {:revision => '2636'} do - it "should return the current revid" do - provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2635 foo\n") - provider.revision.should == @current_revid - end - end - end - context "when given a revid as the resource revision" do - context "when it is the same as the current revid", :resource => {:revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x'} do - before do - provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("1234 #{resource.value(:revision)}\n") - end - it "should return it" do - provider.revision.should == resource.value(:revision) - end - end - context "when it is not the same as the current revid", :resource => {:revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300y'} do - it "should return the current revid" do - provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2636 foo\n") - provider.revision.should == @current_revid - end - end - end - end - - describe "setting the revision property" do - it "should use 'bzr update -r' with the revision" do - revision = 'somerev' - provider.expects('bzr').with('update', '-r', revision, resource.value(:path)) - provider.revision = revision - end - end - -end diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb deleted file mode 100644 index cc195eb..0000000 --- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end } - -describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do - - describe 'creating' do - context "with a source", :resource => {:source => ':ext:source@example.com:/foo/bar'} do - resource_with :revision do - it "should execute 'cvs checkout' and 'cvs update -r'" do - expects_chdir - expects_chdir(File.dirname(resource.value(:path))) - provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) - provider.expects(:cvs).with('update', '-r', resource.value(:revision), '.') - provider.create - end - end - - resource_without :revision do - it "should just execute 'cvs checkout' without a revision" do - provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) - provider.create - end - end - - context "with a compression", :resource => {:compression => '3'} do - it "should just execute 'cvs checkout' without a revision" do - provider.expects(:cvs).with('-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) - provider.create - end - end - end - - context "when a source is not given" do - it "should execute 'cvs init'" do - provider.expects(:cvs).with('-d', resource.value(:path), 'init') - provider.create - end - end - end - - describe 'destroying' do - it "it should remove the directory" do - expects_rm_rf - provider.destroy - end - end - - describe "checking existence" do - resource_with :source do - it "should check for the CVS directory" do - File.expects(:directory?).with(File.join(resource.value(:path), 'CVS')) - provider.exists? - end - end - - resource_without :source do - it "should check for the CVSROOT directory" do - File.expects(:directory?).with(File.join(resource.value(:path), 'CVSROOT')) - provider.exists? - end - end - end - - describe "checking the revision property" do - before do - @tag_file = File.join(resource.value(:path), 'CVS', 'Tag') - end - - context "when CVS/Tag exists" do - before do - @tag = 'HEAD' - File.expects(:exist?).with(@tag_file).returns(true) - end - it "should read CVS/Tag" do - File.expects(:read).with(@tag_file).returns("T#{@tag}") - provider.revision.should == @tag - end - end - - context "when CVS/Tag does not exist" do - before do - File.expects(:exist?).with(@tag_file).returns(false) - end - it "assumes MAIN" do - provider.revision.should == 'MAIN' - end - end - end - - describe "when setting the revision property" do - before do - @tag = 'SOMETAG' - end - - it "should use 'cvs update -r'" do - expects_chdir - provider.expects('cvs').with('update', '-r', @tag, '.') - provider.revision = @tag - end - end - -end diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb deleted file mode 100644 index 4a1085a..0000000 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ /dev/null @@ -1,222 +0,0 @@ -require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end } - -describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do - - context 'creating' do - resource_with :source do - resource_with :ensure => :present do - context "with a revision that is a remote branch", :resource => {:revision => 'only/remote'} do - it "should execute 'git clone' and 'git checkout -b'" do - provider.expects('git').with('clone', resource.value(:source), resource.value(:path)) - expects_chdir - provider.expects(:remote_revision_branch?).returns(true) - provider.expects(:git).with('checkout', '-b', resource.value(:revision), '--track', "origin/#{resource.value(:revision)}") - provider.expects(:update_submodules) - provider.create - end - end - context "with a revision that is not a remote branch", :resource => {:revision => 'a-commit-or-tag'} do - it "should execute 'git clone' and 'git reset --hard'" do - provider.expects('git').with('clone', resource.value(:source), resource.value(:path)) - expects_chdir - provider.expects(:remote_revision_branch?).returns(false) - provider.expects('git').with('reset', '--hard', resource.value(:revision)) - provider.expects(:update_submodules) - provider.create - end - end - resource_without :revision do - it "should execute 'git clone' and submodule commands" do - provider.expects(:git).with('clone', resource.value(:source), resource.value(:path)) - provider.expects(:update_submodules) - provider.create - end - end - end - - resource_with :ensure => :bare do - resource_with :revision do - it "should just execute 'git clone --bare'" do - provider.expects(:git).with('clone', '--bare', resource.value(:source), resource.value(:path)) - provider.create - end - end - - resource_without :revision do - it "should just execute 'git clone --bare'" do - provider.expects(:git).with('clone', '--bare', resource.value(:source), resource.value(:path)) - provider.create - end - end - end - end - - context "when a source is not given" do - resource_with :ensure => :present do - context "when the path does not exist" do - it "should execute 'git init'" do - expects_mkdir - expects_chdir - expects_directory?(false) - provider.expects(:bare_exists?).returns(false) - provider.expects(:git).with('init') - provider.create - end - end - - context "when the path is a bare repository" do - it "should convert it to a working copy" do - provider.expects(:bare_exists?).returns(true) - provider.expects(:convert_bare_to_working_copy) - provider.create - end - end - - context "when the path is not a repository" do - it "should raise an exception" do - expects_directory?(true) - provider.expects(:bare_exists?).returns(false) - proc { provider.create }.should raise_error(Puppet::Error) - end - end - end - - resource_with :ensure => :bare do - context "when the path does not exist" do - it "should execute 'git init --bare'" do - expects_chdir - expects_mkdir - expects_directory?(false) - provider.expects(:working_copy_exists?).returns(false) - provider.expects(:git).with('init', '--bare') - provider.create - end - end - - context "when the path is a working copy repository" do - it "should convert it to a bare repository" do - provider.expects(:working_copy_exists?).returns(true) - provider.expects(:convert_working_copy_to_bare) - provider.create - end - end - - context "when the path is not a repository" do - it "should raise an exception" do - expects_directory?(true) - provider.expects(:working_copy_exists?).returns(false) - proc { provider.create }.should raise_error(Puppet::Error) - end - end - end - end - - end - - context 'destroying' do - it "it should remove the directory" do - expects_rm_rf - provider.destroy - end - end - - context "checking the revision property" do - resource_with :revision do - before do - expects_chdir - provider.expects(:git).with('rev-parse', 'HEAD').returns('currentsha') - end - - context "when its SHA is not different than the current SHA" do - it "should return the ref" do - provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha') - provider.revision.should == resource.value(:revision) - end - end - - context "when its SHA is different than the current SHA" do - it "should return the current SHA" do - provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('othersha') - provider.revision.should == 'currentsha' - end - end - end - end - - context "setting the revision property" do - before do - expects_chdir - provider.expects(:git).with('fetch', 'origin') - end - context "when it's an existing local branch", :resource => {:revision => 'feature/foo'} do - it "should use 'git fetch' and 'git reset'" do - provider.expects(:local_revision_branch?).returns(true) - provider.expects(:git).with('checkout', resource.value(:revision)) - provider.expects(:git).with('pull', 'origin') - provider.expects(:update_submodules) - provider.revision = resource.value(:revision) - end - end - context "when it's a remote branch", :resource => {:revision => 'only/remote'} do - it "should use 'git fetch' and 'git reset'" do - provider.expects(:local_revision_branch?).returns(false) - provider.expects(:remote_revision_branch?).returns(true) - provider.expects(:git).with('checkout', - '-b', resource.value(:revision), - '--track', "origin/#{resource.value(:revision)}") - provider.expects(:update_submodules) - provider.revision = resource.value(:revision) - end - end - context "when it's a commit or tag", :resource => {:revision => 'a-commit-or-tag'} do - it "should use 'git fetch' and 'git reset'" do - provider.expects(:local_revision_branch?).returns(false) - provider.expects(:remote_revision_branch?).returns(false) - provider.expects(:git).with('reset', '--hard', resource.value(:revision)) - provider.expects(:git).with('submodule', 'init') - provider.expects(:git).with('submodule', 'update') - provider.revision = resource.value(:revision) - end - end - end - - context "updating references" do - it "should use 'git fetch --tags'" do - expects_chdir - provider.expects(:git).with('fetch', '--tags', 'origin') - provider.update_references - end - end - - context "checking if revision" do - before do - expects_chdir - provider.expects(:git).with('branch', '-a').returns(fixture(:git_branch_a)) - end - context "is a local branch" do - context "when it's listed in 'git branch -a'", :resource => {:revision => 'feature/foo'} do - it "should return true" do - provider.should be_local_branch_revision - end - end - context "when it's not listed in 'git branch -a'" , :resource => {:revision => 'feature/notexist'}do - it "should return false" do - provider.should_not be_local_branch_revision - end - end - end - context "is a remote branch" do - context "when it's listed in 'git branch -a' with an 'origin/' prefix", :resource => {:revision => 'only/remote'} do - it "should return true" do - provider.should be_remote_branch_revision - end - end - context "when it's not listed in 'git branch -a' with an 'origin/' prefix" , :resource => {:revision => 'only/local'}do - it "should return false" do - provider.should_not be_remote_branch_revision - end - end - end - end - -end diff --git a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb deleted file mode 100644 index 6f32d44..0000000 --- a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb +++ /dev/null @@ -1,104 +0,0 @@ -require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end } - -describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do - - describe 'creating' do - resource_with :source do - resource_with :revision do - it "should execute 'hg clone -u' with the revision" do - provider.expects(:hg).with('clone', '-u', - resource.value(:revision), - resource.value(:source), - resource.value(:path)) - provider.create - end - end - - resource_without :revision do - it "should just execute 'hg clone' without a revision" do - provider.expects(:hg).with('clone', resource.value(:source), resource.value(:path)) - provider.create - end - end - end - - context "when a source is not given" do - it "should execute 'hg init'" do - provider.expects(:hg).with('init', resource.value(:path)) - provider.create - end - end - end - - describe 'destroying' do - it "it should remove the directory" do - expects_rm_rf - provider.destroy - end - end - - describe "checking existence" do - it "should check for the directory" do - expects_directory?(true, File.join(resource.value(:path), '.hg')) - provider.exists? - end - end - - describe "checking the revision property" do - before do - expects_chdir - end - - context "when given a non-SHA as the resource revision" do - before do - provider.expects(:hg).with('parents').returns(fixture(:hg_parents)) - provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) - end - - context "when its SHA is not different than the current SHA", :resource => {:revision => '0.6'} do - it "should return the ref" do - provider.revision.should == '0.6' - end - end - - context "when its SHA is different than the current SHA", :resource => {:revision => '0.5.3'} do - it "should return the current SHA" do - provider.revision.should == '34e6012c783a' - end - end - end - context "when given a SHA as the resource revision" do - before do - provider.expects(:hg).with('parents').returns(fixture(:hg_parents)) - end - - context "when it is the same as the current SHA", :resource => {:revision => '34e6012c783a'} do - it "should return it" do - provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) - provider.revision.should == resource.value(:revision) - end - end - - context "when it is not the same as the current SHA", :resource => {:revision => 'not-the-same'} do - it "should return the current SHA" do - provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) - provider.revision.should == '34e6012c783a' - end - end - end - end - - describe "setting the revision property" do - before do - @revision = '6aa99e9b3ab1' - end - it "should use 'hg update ---clean -r'" do - expects_chdir - provider.expects('hg').with('pull') - provider.expects('hg').with('merge') - provider.expects('hg').with('update', '--clean', '-r', @revision) - provider.revision = @revision - end - end - -end diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb deleted file mode 100644 index db4a4c7..0000000 --- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb +++ /dev/null @@ -1,78 +0,0 @@ -require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end } - -describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do - - describe 'creating' do - resource_with :source do - resource_with :revision do - it "should execute 'svn checkout' with a revision" do - provider.expects(:svn).with('checkout', '-r', - resource.value(:revision), - resource.value(:source), - resource.value(:path)) - provider.create - end - end - resource_without :revision do - it "should just execute 'svn checkout' without a revision" do - provider.expects(:svn).with('checkout', - resource.value(:source), - resource.value(:path)) - provider.create - end - end - end - resource_without :source do - resource_with :fstype do - it "should execute 'svnadmin create' with an '--fs-type' option" do - provider.expects(:svnadmin).with('create', '--fs-type', - resource.value(:fstype), - resource.value(:path)) - provider.create - end - end - resource_without :fstype do - it "should execute 'svnadmin create' without an '--fs-type' option" do - provider.expects(:svnadmin).with('create', resource.value(:path)) - provider.create - end - end - end - end - - describe 'destroying' do - it "it should remove the directory" do - expects_rm_rf - provider.destroy - end - end - - describe "checking existence" do - it "should check for the directory" do - expects_directory?(true, File.join(resource.value(:path), '.svn')) - provider.exists? - end - end - - describe "checking the revision property" do - before do - provider.expects('svn').with('info').returns(fixture(:svn_info)) - end - it "should use 'svn info'" do - expects_chdir - provider.revision.should == '4' - end - end - - describe "setting the revision property" do - before do - @revision = '30' - end - it "should use 'svn update'" do - expects_chdir - provider.expects('svn').with('update', '-r', @revision) - provider.revision = @revision - end - end - -end diff --git a/spec/unit/puppet/type/README.markdown b/spec/unit/puppet/type/README.markdown deleted file mode 100644 index 1ee19ac..0000000 --- a/spec/unit/puppet/type/README.markdown +++ /dev/null @@ -1,4 +0,0 @@ -Resource Type Specs -=================== - -Define specs for your resource types in this directory.