summaryrefslogtreecommitdiff
path: root/spec/unit/provider
diff options
context:
space:
mode:
authortylercloke <tyler@opscode.com>2012-11-05 13:25:00 -0800
committertylercloke <tyler@opscode.com>2012-11-05 16:07:55 -0800
commitd0238d6ff8a32b10a76ae8ec059c8794d30ed6f3 (patch)
treed74d5d390e1ba9732e3ce04b042c58b694ebed34 /spec/unit/provider
parent926726fb40f738fa7d0c1c7944c8c3350a1694e8 (diff)
downloadchef-d0238d6ff8a32b10a76ae8ec059c8794d30ed6f3.tar.gz
Finished refactoring converge and updated tests
so that converge and converge! are no longer a method in the provider and why_run, respectively. There is instead set_updated_status in provider. Everything is now converged in why_run's add_action, so neither of the converge methods should ever need to be called. Updated tests to reflect this. Removed all calls to converge, and replaced with set_updated_status only for tests that are looking at the update status of a provider, where the converge behavior has been mocked out.
Diffstat (limited to 'spec/unit/provider')
-rw-r--r--spec/unit/provider/deploy/revision_spec.rb6
-rw-r--r--spec/unit/provider/deploy_spec.rb41
-rw-r--r--spec/unit/provider/erl_call_spec.rb2
-rw-r--r--spec/unit/provider/file_spec.rb1
-rw-r--r--spec/unit/provider/git_spec.rb10
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb2
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb18
-rw-r--r--spec/unit/provider/package/yum_spec.rb4
-rw-r--r--spec/unit/provider/route_spec.rb2
-rw-r--r--spec/unit/provider/service_spec.rb4
-rw-r--r--spec/unit/provider/user_spec.rb23
11 files changed, 12 insertions, 101 deletions
diff --git a/spec/unit/provider/deploy/revision_spec.rb b/spec/unit/provider/deploy/revision_spec.rb
index 396dd09a8e..3287c085d5 100644
--- a/spec/unit/provider/deploy/revision_spec.rb
+++ b/spec/unit/provider/deploy/revision_spec.rb
@@ -55,11 +55,9 @@ describe Chef::Provider::Deploy::Revision do
FileUtils.stub!(:mkdir_p)
@provider.stub!(:run_command).and_return(true)
@provider.copy_cached_repo
- @provider.converge
@provider.stub!(:release_slug).and_return("73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2")
@provider.load_current_resource
@provider.copy_cached_repo
- @provider.converge
second_release = "/my/deploy/dir/releases/73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2"
@provider.all_releases.should == [@expected_release_dir,second_release]
@@ -69,20 +67,16 @@ describe Chef::Provider::Deploy::Revision do
FileUtils.stub!(:mkdir_p)
@provider.stub!(:run_command).and_return(true)
@provider.copy_cached_repo
- @provider.converge
@provider.stub!(:release_slug).and_return("73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2")
@provider.load_current_resource
@provider.copy_cached_repo
- @provider.converge
second_release = "/my/deploy/dir/releases/73219b87e977d9c7ba1aa57e9ad1d88fa91a0ec2"
@provider.all_releases.should == [@expected_release_dir,second_release]
@provider.copy_cached_repo
- @provider.converge
@provider.stub!(:release_slug).and_return("8a3195bf3efa246f743c5dfa83683201880f935c")
@provider.load_current_resource
@provider.copy_cached_repo
- @provider.converge
@provider.all_releases.should == [second_release, @expected_release_dir]
end
diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb
index 4a8e5b8bff..ebbc6e2823 100644
--- a/spec/unit/provider/deploy_spec.rb
+++ b/spec/unit/provider/deploy_spec.rb
@@ -59,12 +59,6 @@ describe Chef::Provider::Deploy do
@provider.deploy
end
- it "creates deploy_to dir before calling update_cached_repo (CHEF-3435)" do
- ::Dir.should_receive(:chdir).with(@expected_release_dir).exactly(4).times
- @provider.send(:converge_actions).should_receive(:empty?).and_return(false)
- @provider.should_receive(:update_cached_repo).ordered
- @provider.deploy
- end
end
it "does not create deploy_to dir if it exists" do
@@ -77,7 +71,6 @@ describe Chef::Provider::Deploy do
@provider.stub(:symlink)
@provider.stub(:migrate)
@provider.deploy
- @provider.converge
end
it "ensures the deploy_to dir ownership after the verfication that it exists" do
@@ -109,7 +102,6 @@ describe Chef::Provider::Deploy do
@provider.should_receive(:callback).with(:after_restart, nil)
@provider.should_receive(:cleanup!)
@provider.deploy
- @provider.converge
end
it "should not deploy if there is already a deploy at release_path, and it is the current release" do
@@ -137,7 +129,6 @@ describe Chef::Provider::Deploy do
@resource.svn_force_export true
@provider.scm_provider.should_receive(:run_action).with(:force_export)
@provider.update_cached_repo
- @provider.converge
end
it "Removes the old release before deploying when force deploying over it" do
@@ -262,7 +253,6 @@ describe Chef::Provider::Deploy do
@runner.should_receive(:converge)
callback_code = Proc.new { :noop }
@provider.callback(:whatevs, callback_code)
- @provider.converge
end
it "loads callback files from the release/ dir if the file exists" do
@@ -271,7 +261,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(foo_callback)
@provider.callback(:foo, "deploy/foo.rb")
- @provider.converge
end
it "raises a runtime error if a callback file is explicitly specified but does not exist" do
@@ -289,7 +278,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(bar_callback)
@provider.callback(:bar, nil)
- @provider.converge
end
it "skips an eval callback if the file doesn't exist" do
@@ -298,7 +286,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_not_receive(:from_file)
@provider.callback(:barbaz, nil)
- @provider.converge
end
# CHEF-3449 #converge_by is called in #recipe_eval and must happen in sequence
@@ -329,14 +316,12 @@ describe Chef::Provider::Deploy do
it "syncs the cached copy of the repo" do
@provider.scm_provider.should_receive(:run_action).with(:sync)
@provider.update_cached_repo
- @provider.converge
end
it "makes a copy of the cached repo in releases dir" do
FileUtils.should_receive(:mkdir_p).with("/my/deploy/dir/releases")
@provider.should_receive(:run_command).with({:command => "cp -RPp /my/deploy/dir/shared/cached-copy/. #{@expected_release_dir}"})
@provider.copy_cached_repo
- @provider.converge
end
it "calls the internal callback :release_created when copying the cached repo" do
@@ -344,7 +329,6 @@ describe Chef::Provider::Deploy do
@provider.stub!(:run_command).and_return(true)
@provider.should_receive(:release_created)
@provider.copy_cached_repo
- @provider.converge
end
it "chowns the whole release dir to user and group specified in the resource" do
@@ -352,7 +336,6 @@ describe Chef::Provider::Deploy do
@resource.group "bar"
FileUtils.should_receive(:chown_R).with("foo", "bar", "/my/deploy/dir")
@provider.enforce_ownership
- @provider.converge
end
it "skips the migration when resource.migrate => false but runs symlinks before migration" do
@@ -360,7 +343,6 @@ describe Chef::Provider::Deploy do
@provider.should_not_receive :run_command
@provider.should_receive :run_symlinks_before_migrate
@provider.migrate
- @provider.converge
end
it "links the database.yml and runs resource.migration_command when resource.migrate #=> true" do
@@ -380,7 +362,6 @@ describe Chef::Provider::Deploy do
:log_tag => "deploy[/my/deploy/dir]",
:environment => {"RAILS_ENV"=>"production"})
@provider.migrate
- @provider.converge
end
it "purges the current release's /log /tmp/pids/ and /public/system directories" do
@@ -388,7 +369,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/tmp/pids")
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/public/system")
@provider.purge_tempfiles_from_current_release
- @provider.converge
end
it "symlinks temporary files and logs from the shared dir into the current release" do
@@ -404,7 +384,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with("/my/deploy/dir/shared/config/database.yml", @expected_release_dir + "/config/database.yml")
@provider.should_receive(:enforce_ownership)
@provider.link_tempfiles_to_current_release
- @provider.converge
end
it "symlinks the current release dir into production" do
@@ -412,7 +391,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with(@expected_release_dir, "/my/deploy/dir/current")
@provider.should_receive(:enforce_ownership)
@provider.link_current_release_to_production
- @provider.converge
end
context "with a customized app layout" do
@@ -422,14 +400,12 @@ describe Chef::Provider::Deploy do
@resource.create_dirs_before_symlink(%w{baz qux})
@resource.symlinks "foo/bar" => "foo/bar", "baz" => "qux/baz"
@resource.symlink_before_migrate "radiohead/in_rainbows.yml" => "awesome"
- @provider.converge
end
it "purges the purge_before_symlink directories" do
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/foo")
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/bar")
@provider.purge_tempfiles_from_current_release
- @provider.converge
end
it "symlinks files from the shared directory to the current release directory" do
@@ -442,7 +418,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with("/my/deploy/dir/shared/radiohead/in_rainbows.yml", @expected_release_dir + "/awesome")
@provider.should_receive(:enforce_ownership)
@provider.link_tempfiles_to_current_release
- @provider.converge
end
end
@@ -450,14 +425,12 @@ describe Chef::Provider::Deploy do
it "does nothing for restart if restart_command is empty" do
@provider.should_not_receive(:run_command)
@provider.restart
- @provider.converge
end
it "runs the restart command in the current application dir when the resource has a restart_command" do
@resource.restart_command "restartcmd"
@provider.should_receive(:run_command).with(:command => "restartcmd", :cwd => "/my/deploy/dir/current", :log_tag => "deploy[/my/deploy/dir]", :log_level => :debug)
@provider.restart
- @provider.converge
end
it "lists all available releases" do
@@ -477,7 +450,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040200000000")
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040300000000")
@provider.cleanup!
- @provider.converge
end
it "removes all but a certain number of releases when the resource has a keep_releases" do
@@ -489,7 +461,6 @@ describe Chef::Provider::Deploy do
@provider.stub!(:all_releases).and_return(all_releases)
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040100000000")
@provider.cleanup!
- @provider.converge
end
it "fires a callback for :release_deleted when deleting an old release" do
@@ -500,7 +471,6 @@ describe Chef::Provider::Deploy do
FileUtils.stub!(:rm_rf)
@provider.should_receive(:release_deleted).with("/my/deploy/dir/20040300000000")
@provider.cleanup!
- @provider.converge
end
it "puts resource.to_hash in @configuration for backwards compat with capistano-esque deploy hooks" do
@@ -512,7 +482,6 @@ describe Chef::Provider::Deploy do
resource.environment "production"
provider = Chef::Provider::Deploy.new(resource, @run_context)
provider.instance_variable_get(:@configuration)[:environment].should eql("production")
- @provider.converge
end
it "shouldn't give a no method error on migrate if the environment is nil" do
@@ -520,7 +489,7 @@ describe Chef::Provider::Deploy do
@provider.stub!(:run_symlinks_before_migrate)
@provider.stub!(:run_command)
@provider.migrate
- @provider.converge
+
end
context "using inline recipes for callbacks" do
@@ -530,7 +499,6 @@ describe Chef::Provider::Deploy do
recipe_code = Proc.new {snitch = 42}
#@provider.should_receive(:instance_eval).with(&recipe_code)
@provider.callback(:whateverz, recipe_code)
- @provider.converge
snitch.should == 42
end
@@ -539,7 +507,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(@expected_release_dir + "/chefz/foobar_callback.rb")
@provider.callback(:whateverz, "chefz/foobar_callback.rb")
- @provider.converge
end
it "instance_evals a block/proc for restart command" do
@@ -547,7 +514,6 @@ describe Chef::Provider::Deploy do
restart_cmd = Proc.new {snitch = 42}
@resource.restart(&restart_cmd)
@provider.restart
- @provider.converge
snitch.should == 42
end
@@ -557,7 +523,6 @@ describe Chef::Provider::Deploy do
it "defines sudo as a forwarder to execute" do
@provider.should_receive(:execute).with("the moon, fool")
@provider.sudo("the moon, fool")
- @provider.converge
end
it "defines run as a forwarder to execute, setting the user, group, cwd and environment to new_resource.user" do
@@ -586,7 +551,7 @@ describe Chef::Provider::Deploy do
end
}.twice
@provider.run("iGoToHell4this")
- @provider.converge
+
end
it "defines run as a forwarder to execute, setting cwd and environment but not override" do
@@ -597,7 +562,6 @@ describe Chef::Provider::Deploy do
mock_execution.should_receive(:cwd).with(no_args()).and_return("/some/value")
mock_execution.should_receive(:environment).with(no_args()).and_return({})
@provider.run("iGoToHell4this")
- @provider.converge
end
@@ -618,7 +582,6 @@ describe Chef::Provider::Deploy do
runner.should_receive(:converge)
#
@provider.callback(:phony, callback_code)
- @provider.converge
snitch.should be_an_instance_of(Chef::Resource::Execute)
snitch.user.should == "tehCat"
end
diff --git a/spec/unit/provider/erl_call_spec.rb b/spec/unit/provider/erl_call_spec.rb
index df7910424b..fa85b6cda7 100644
--- a/spec/unit/provider/erl_call_spec.rb
+++ b/spec/unit/provider/erl_call_spec.rb
@@ -60,7 +60,6 @@ describe Chef::Provider::ErlCall do
Process.should_receive(:wait).with(@pid)
@provider.action_run
- @provider.converge
@stdin.string.should == "#{@new_resource.code}\n"
end
@@ -78,7 +77,6 @@ describe Chef::Provider::ErlCall do
Process.should_receive(:wait).with(@pid)
@provider.action_run
- @provider.converge
@stdin.string.should == "#{@new_resource.code}\n"
end
diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb
index 28d2aac2b5..9f5ad3a8f8 100644
--- a/spec/unit/provider/file_spec.rb
+++ b/spec/unit/provider/file_spec.rb
@@ -176,7 +176,6 @@ describe Chef::Provider::File do
@provider.should_receive(:backup)
File.should_receive(:open).with(@provider.new_resource.path, "w").and_yield(io)
@provider.set_content
- lambda { @provider.send(:converge_actions).converge! }.should_not raise_error
io.string.should == "foobar"
end
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index bb8208dc27..275b2907ec 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -163,7 +163,6 @@ SHAS
:environment =>{"GIT_SSH"=>"do_it_this_way.sh"}, :log_level => :info, :log_tag => "git[web2.0 app]", :live_stream => STDOUT)
@provider.clone
- @provider.converge
end
it "runs a clone command with escaped destination" do
@@ -174,7 +173,6 @@ SHAS
@provider.should_receive(:shell_out!).with(expected_cmd, :user => "deployNinja",
:environment =>{"GIT_SSH"=>"do_it_this_way.sh"}, :log_level => :info, :log_tag => "git[web2.0 app]", :live_stream => STDOUT)
@provider.clone
- @provider.converge
end
it "compiles a clone command using --depth for shallow cloning" do
@@ -182,7 +180,6 @@ SHAS
expected_cmd = 'git clone --depth 5 git://github.com/opscode/chef.git /my/deploy/dir'
@provider.should_receive(:shell_out!).with(expected_cmd, {:log_level => :info, :log_tag => "git[web2.0 app]", :live_stream => STDOUT})
@provider.clone
- @provider.converge
end
it "compiles a clone command with a remote other than ``origin''" do
@@ -190,14 +187,12 @@ SHAS
expected_cmd = 'git clone -o opscode git://github.com/opscode/chef.git /my/deploy/dir'
@provider.should_receive(:shell_out!).with(expected_cmd, {:log_level => :info, :log_tag => "git[web2.0 app]", :live_stream => STDOUT})
@provider.clone
- @provider.converge
end
it "runs a checkout command with default options" do
expected_cmd = 'git checkout -b deploy d35af14d41ae22b19da05d7d03a0bafc321b244c'
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir", :log_level => :debug, :log_tag => "git[web2.0 app]")
@provider.checkout
- @provider.converge
end
it "runs an enable_submodule command" do
@@ -205,20 +200,17 @@ SHAS
expected_cmd = "git submodule update --init --recursive"
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir", :log_level => :info, :log_tag => "git[web2.0 app]", :live_stream => STDOUT)
@provider.enable_submodules
- @provider.converge
end
it "does nothing for enable_submodules if resource.enable_submodules #=> false" do
@provider.should_not_receive(:shell_out!)
@provider.enable_submodules
- @provider.converge
end
it "runs a sync command with default options" do
expected_cmd = "git fetch origin && git fetch origin --tags && git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd=> "/my/deploy/dir", :log_level => :debug, :log_tag => "git[web2.0 app]")
@provider.fetch_updates
- @provider.converge
end
it "runs a sync command with the user and group specified in the resource" do
@@ -228,7 +220,6 @@ SHAS
@provider.should_receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir",
:user => "whois", :group => "thisis", :log_level => :debug, :log_tag => "git[web2.0 app]")
@provider.fetch_updates
- @provider.converge
end
it "configures remote tracking branches when remote is not ``origin''" do
@@ -239,7 +230,6 @@ SHAS
fetch_command = "git fetch opscode && git fetch opscode --tags && git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
@provider.should_receive(:shell_out!).with(fetch_command, :cwd => "/my/deploy/dir", :log_level => :debug, :log_tag => "git[web2.0 app]")
@provider.fetch_updates
- @provider.converge
end
it "raises an error if the git clone command would fail because the enclosing directory doesn't exist" do
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index f08e14f99b..5e07da59b4 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -132,7 +132,7 @@ describe Chef::Provider::Group::Groupadd do
describe "modify_group_members" do
it "should raise an error when calling modify_group_members" do
- lambda { @provider.modify_group_members ; @provider.converge }.should raise_error(Chef::Exceptions::Group, "you must override modify_group_members in #{@provider.to_s}")
+ lambda { @provider.modify_group_members }.should raise_error(Chef::Exceptions::Group, "you must override modify_group_members in #{@provider.to_s}")
end
end
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index be4c3a99c4..b3b7a030db 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -439,7 +439,6 @@ describe Chef::Provider::Package::Rubygems do
it "installs the gem via the gems api when no explicit options are used" do
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem via the gems api when a remote source is provided" do
@@ -447,14 +446,12 @@ describe Chef::Provider::Package::Rubygems do
sources = ['http://gems.example.org']
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => sources)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem from file via the gems api when no explicit options are used" do
@new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
@provider.gem_env.should_receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem from file via the gems api when the package is a path and the source is nil" do
@@ -464,7 +461,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.source.should == CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem'
@provider.gem_env.should_receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
@provider.action_install.should be_true
- @provider.converge
end
# this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem
@@ -473,7 +469,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.package_name('rspec-core')
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem by shelling out when options are provided as a String" do
@@ -481,14 +476,12 @@ describe Chef::Provider::Package::Rubygems do
expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" -i /alt/install/location"
@provider.should_receive(:shell_out!).with(expected, :env => nil)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem via the gems api when options are given as a Hash" do
@new_resource.options(:install_dir => '/alt/install/location')
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil, :install_dir => '/alt/install/location')
@provider.action_install.should be_true
- @provider.converge
end
describe "at a specific version" do
@@ -499,7 +492,6 @@ describe Chef::Provider::Package::Rubygems do
it "installs the gem via the gems api" do
@provider.gem_env.should_receive(:install).with(@gem_dep, :sources => nil)
@provider.action_install.should be_true
- @provider.converge
end
end
describe "at version specified with comparison operator" do
@@ -509,7 +501,6 @@ describe Chef::Provider::Package::Rubygems do
@provider.gem_env.should_not_receive(:install)
@provider.action_install
- @provider.converge
end
it "allows user to specify gem version with fuzzy operator" do
@@ -518,7 +509,6 @@ describe Chef::Provider::Package::Rubygems do
@provider.gem_env.should_not_receive(:install)
@provider.action_install
- @provider.converge
end
end
end
@@ -528,7 +518,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.gem_binary('/usr/weird/bin/gem')
@provider.should_receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", :env=>nil)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem from file by shelling out to gem install" do
@@ -537,7 +526,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.version('>= 0')
@provider.should_receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :env=>nil)
@provider.action_install.should be_true
- @provider.converge
end
it "installs the gem from file by shelling out to gem install when the package is a path and the source is nil" do
@@ -549,7 +537,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.source.should == CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem'
@provider.should_receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :env=>nil)
@provider.action_install.should be_true
- @provider.converge
end
end
@@ -572,7 +559,6 @@ describe Chef::Provider::Package::Rubygems do
# the behavior we're testing:
@provider.gem_env.should_receive(:uninstall).with('rspec', nil)
@provider.action_remove
- @provider.converge
end
it "uninstalls via the api when options are given as a Hash" do
@@ -583,21 +569,18 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.options(:install_dir => '/alt/install/location')
@provider.gem_env.should_receive(:uninstall).with('rspec', nil, :install_dir => '/alt/install/location')
@provider.action_remove
- @provider.converge
end
it "uninstalls via the gem command when options are given as a String" do
@new_resource.options('-i /alt/install/location')
@provider.should_receive(:shell_out!).with("gem uninstall rspec -q -x -I -a -i /alt/install/location", :env=>nil)
@provider.action_remove
- @provider.converge
end
it "uninstalls a specific version of a gem when a version is provided" do
@new_resource.version('1.2.3')
@provider.gem_env.should_receive(:uninstall).with('rspec', '1.2.3')
@provider.action_remove
- @provider.converge
end
end
@@ -606,7 +589,6 @@ describe Chef::Provider::Package::Rubygems do
@new_resource.gem_binary('/usr/weird/bin/gem')
@provider.should_receive(:shell_out!).with("/usr/weird/bin/gem uninstall rspec -q -x -I -a", :env=>nil)
@provider.action_remove
- @provider.converge
end
end
end
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index 0002ec39f3..4b890b1549 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -504,7 +504,6 @@ describe Chef::Provider::Package::Yum do
"11"
)
@provider.action_upgrade
- @provider.converge
end
it "should call action_upgrade in the parent if the candidate version is nil" do
@@ -513,7 +512,6 @@ describe Chef::Provider::Package::Yum do
@provider.candidate_version = nil
@provider.should_not_receive(:upgrade_package)
@provider.action_upgrade
- @provider.converge
end
it "should call action_upgrade in the parent if the candidate is newer" do
@@ -525,7 +523,6 @@ describe Chef::Provider::Package::Yum do
"11"
)
@provider.action_upgrade
- @provider.converge
end
it "should not call action_upgrade in the parent if the candidate is older" do
@@ -535,7 +532,6 @@ describe Chef::Provider::Package::Yum do
@provider.candidate_version = '11'
@provider.should_not_receive(:upgrade_package)
@provider.action_upgrade
- @provider.converge
end
end
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb
index 3c5db0b7a1..bcbed10026 100644
--- a/spec/unit/provider/route_spec.rb
+++ b/spec/unit/provider/route_spec.rb
@@ -206,7 +206,6 @@ describe Chef::Provider::Route do
@run_context.resource_collection << @new_resource
@provider.generate_config
- @provider.converge
end
end
@@ -220,7 +219,6 @@ describe Chef::Provider::Route do
@run_context.resource_collection << Chef::Resource::Route.new('192.168.3.0/24 via 192.168.0.1')
@provider.generate_config
- @provider.converge
route_file.string.split("\n").should have(3).items
route_file.string.should match(/^192.168.1.0\/24 via 192.168.0.1$/)
route_file.string.should match(/^192.168.2.0\/24 via 192.168.0.1$/)
diff --git a/spec/unit/provider/service_spec.rb b/spec/unit/provider/service_spec.rb
index d25d7cf735..6b2b758f21 100644
--- a/spec/unit/provider/service_spec.rb
+++ b/spec/unit/provider/service_spec.rb
@@ -36,7 +36,7 @@ describe Chef::Provider::Service do
@current_resource.enabled(false)
@provider.should_receive(:enable_service).and_return(true)
@provider.action_enable
- @provider.converge
+ @provider.set_updated_status
@provider.new_resource.should be_updated
end
@@ -44,7 +44,7 @@ describe Chef::Provider::Service do
@current_resource.enabled(true)
@provider.should_not_receive(:enable_service)
@provider.action_enable
- @provider.converge
+ @provider.set_updated_status
@provider.new_resource.should_not be_updated
end
end
diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb
index 4066ffd7fe..9c4e2847f7 100644
--- a/spec/unit/provider/user_spec.rb
+++ b/spec/unit/provider/user_spec.rb
@@ -250,7 +250,7 @@ describe Chef::Provider::User do
@provider.user_exists = false
@provider.should_receive(:create_user).and_return(true)
@provider.action_create
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
@@ -259,7 +259,6 @@ describe Chef::Provider::User do
@provider.stub!(:compare_user).and_return(true)
@provider.should_receive(:manage_user).and_return(true)
@provider.action_create
- @provider.converge
end
it "should set the the new_resources updated flag when it creates the user if we call manage_user" do
@@ -267,7 +266,7 @@ describe Chef::Provider::User do
@provider.stub!(:compare_user).and_return(true)
@provider.stub!(:manage_user).and_return(true)
@provider.action_create
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
end
@@ -281,21 +280,19 @@ describe Chef::Provider::User do
@provider.user_exists = false
@provider.should_not_receive(:remove_user)
@provider.action_remove
- @provider.converge
end
it "should call remove_user if the user exists" do
@provider.user_exists = true
@provider.should_receive(:remove_user)
@provider.action_remove
- @provider.converge
end
it "should set the new_resources updated flag to true if the user is removed" do
@provider.user_exists = true
@provider.should_receive(:remove_user)
@provider.action_remove
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
end
@@ -320,14 +317,13 @@ describe Chef::Provider::User do
@provider.should_receive(:compare_user).and_return(true)
@provider.should_receive(:manage_user).and_return(true)
@provider.action_manage
- @provider.converge
end
it "should set the new resources updated flag to true if manage_user is called" do
@provider.stub!(:compare_user).and_return(true)
@provider.stub!(:manage_user).and_return(true)
@provider.action_manage
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
@@ -335,14 +331,12 @@ describe Chef::Provider::User do
@provider.user_exists = false
@provider.should_not_receive(:manage_user)
@provider.action_manage
- @provider.converge
end
it "should not run manage_user if the user exists but has no differing attributes" do
@provider.should_receive(:compare_user).and_return(false)
@provider.should_not_receive(:manage_user)
@provider.action_manage
- @provider.converge
end
end
@@ -366,14 +360,13 @@ describe Chef::Provider::User do
@provider.should_receive(:compare_user).and_return(true)
@provider.should_receive(:manage_user).and_return(true)
@provider.action_modify
- @provider.converge
end
it "should set the new resources updated flag to true if manage_user is called" do
@provider.stub!(:compare_user).and_return(true)
@provider.stub!(:manage_user).and_return(true)
@provider.action_modify
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
@@ -381,7 +374,6 @@ describe Chef::Provider::User do
@provider.should_receive(:compare_user).and_return(false)
@provider.should_not_receive(:manage_user)
@provider.action_modify
- @provider.converge
end
it "should raise a Chef::Exceptions::User if the user doesn't exist" do
@@ -399,14 +391,13 @@ describe Chef::Provider::User do
@provider.stub!(:check_lock).and_return(false)
@provider.should_receive(:lock_user).and_return(true)
@provider.action_lock
- @provider.converge
end
it "should set the new resources updated flag to true if lock_user is called" do
@provider.stub!(:check_lock).and_return(false)
@provider.should_receive(:lock_user)
@provider.action_lock
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end
@@ -439,7 +430,7 @@ describe Chef::Provider::User do
@provider.stub!(:check_lock).and_return(true)
@provider.should_receive(:unlock_user).and_return(true)
@provider.action_unlock
- @provider.converge
+ @provider.set_updated_status
@new_resource.should be_updated
end