summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Williams <bruce@codefluency.com>2010-03-18 01:52:34 -0700
committerBruce Williams <bruce@codefluency.com>2010-03-18 01:52:34 -0700
commit94800be9501c9831c6b9317f52468d24c76d57b9 (patch)
tree158a22297e692a16ba72af4681ffa6437fca5e85
parente7d7e2217d54d8c87dd9897f4fe1bfbdb5038d02 (diff)
Move support file
-rw-r--r--spec/support/provider_example_group.rb (renamed from spec/support/resource_helpers.rb)4
-rw-r--r--spec/unit/puppet/provider/vcsrepo/bzr_spec.rb8
-rw-r--r--spec/unit/puppet/provider/vcsrepo/cvs_spec.rb8
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb20
-rw-r--r--spec/unit/puppet/provider/vcsrepo/hg_spec.rb6
-rw-r--r--spec/unit/puppet/provider/vcsrepo/svn_spec.rb12
6 files changed, 29 insertions, 29 deletions
diff --git a/spec/support/resource_helpers.rb b/spec/support/provider_example_group.rb
index a4bc74e..626372d 100644
--- a/spec/support/resource_helpers.rb
+++ b/spec/support/provider_example_group.rb
@@ -23,7 +23,7 @@ class ProviderExampleGroup < Spec::Example::ExampleGroup
#
# given(:ensure)
# given(:ensure => :present)
- def context_with_resource(*args, &block)
+ def resource_with(*args, &block)
options = args.last.is_a?(Hash) ? args.pop : {}
if args.empty?
text = options.map { |k, v| "#{k} => #{v.inspect}" }.join(' and with ')
@@ -35,7 +35,7 @@ class ProviderExampleGroup < Spec::Example::ExampleGroup
end
end
- def context_without_resource(field, &block)
+ def resource_without(field, &block)
context("and without a #{field}", &block)
end
diff --git a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
index ef72cfb..f073b8e 100644
--- a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
@@ -3,21 +3,21 @@ require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require
describe_provider :vcsrepo, :bzr, :resource => {:path => '/tmp/vcsrepo'} do
describe 'creating' do
- context_with_resource :source do
- context_with_resource :revision 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
- context_without_resource :revision do
+ 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
- context_without_resource :source do
+ resource_without :source do
it "should execute 'bzr init'" do
provider.expects(:bzr).with('init', resource.value(:path))
provider.create
diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
index 32f4bbb..cc195eb 100644
--- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
@@ -4,7 +4,7 @@ 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
- context_with_resource :revision do
+ resource_with :revision do
it "should execute 'cvs checkout' and 'cvs update -r'" do
expects_chdir
expects_chdir(File.dirname(resource.value(:path)))
@@ -14,7 +14,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
end
end
- context_without_resource :revision do
+ 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
@@ -45,14 +45,14 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
end
describe "checking existence" do
- context_with_resource :source 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
- context_without_resource :source do
+ resource_without :source do
it "should check for the CVSROOT directory" do
File.expects(:directory?).with(File.join(resource.value(:path), 'CVSROOT'))
provider.exists?
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index aef3e91..073be13 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -3,9 +3,9 @@ require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require
describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
context 'creating' do
- context_with_resource :source do
- context_with_resource :ensure => :present do
- context_with_resource :revision do
+ resource_with :source do
+ resource_with :ensure => :present do
+ resource_with :revision do
it "should execute 'git clone' and 'git reset --hard'" do
provider.expects('git').with('clone', resource.value(:source), resource.value(:path))
expects_chdir
@@ -14,7 +14,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
- context_without_resource :revision do
+ resource_without :revision do
it "should just execute 'git clone'" do
provider.expects(:git).with('clone', resource.value(:source), resource.value(:path))
provider.create
@@ -22,15 +22,15 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
- context_with_resource :ensure => :bare do
- context_with_resource :revision do
+ resource_with :ensure => :bare do
+ resource_with :revision do
it "should just execute 'git clone --bare'" do
subject.expects(:git).with('clone', '--bare', resource.value(:source), resource.value(:path))
subject.create
end
end
- context_without_resource :revision do
+ resource_without :revision do
it "should just execute 'git clone --bare'" do
subject.expects(:git).with('clone', '--bare', resource.value(:source), resource.value(:path))
subject.create
@@ -40,7 +40,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
context "when a source is not given" do
- context_with_resource :ensure => :present do
+ resource_with :ensure => :present do
context "when the path does not exist" do
it "should execute 'git init'" do
expects_mkdir
@@ -69,7 +69,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
- context_with_resource :ensure => :bare do
+ resource_with :ensure => :bare do
context "when the path does not exist" do
it "should execute 'git init --bare'" do
expects_chdir
@@ -109,7 +109,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
context "checking the revision property" do
- context_with_resource :revision do
+ resource_with :revision do
before do
expects_chdir
provider.expects(:git).with('rev-parse', 'HEAD').returns('currentsha')
diff --git a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
index 9aebb6b..53e5596 100644
--- a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
@@ -3,8 +3,8 @@ require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require
describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do
describe 'creating' do
- context_with_resource :source do
- context_with_resource :revision 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),
@@ -14,7 +14,7 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do
end
end
- context_without_resource :revision do
+ 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
diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
index b9c7d13..db4a4c7 100644
--- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
@@ -3,8 +3,8 @@ require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require
describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
describe 'creating' do
- context_with_resource :source do
- context_with_resource :revision 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),
@@ -13,7 +13,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
- context_without_resource :revision do
+ resource_without :revision do
it "should just execute 'svn checkout' without a revision" do
provider.expects(:svn).with('checkout',
resource.value(:source),
@@ -22,8 +22,8 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
- context_without_resource :source do
- context_with_resource :fstype do
+ 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),
@@ -31,7 +31,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
- context_without_resource :fstype do
+ 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