diff options
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/mixin/template_spec.rb | 60 | ||||
-rw-r--r-- | spec/unit/mixin/windows_architecture_helper_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/node_spec.rb | 10 | ||||
-rw-r--r-- | spec/unit/provider/remote_directory_spec.rb | 18 | ||||
-rw-r--r-- | spec/unit/provider_resolver_spec.rb | 10 |
5 files changed, 53 insertions, 53 deletions
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb index 88a16c2a84..63522839e9 100644 --- a/spec/unit/mixin/template_spec.rb +++ b/spec/unit/mixin/template_spec.rb @@ -104,16 +104,16 @@ describe Chef::Mixin::Template, "render_template" do end it "should render local files" do - begin - tf = Tempfile.new("partial") - tf.write "test" - tf.rewind - - output = @template_context.render_template_from_string("before {<%= render '#{tf.path}', :local => true %>} after") - expect(output).to eq("before {test} after") - ensure - tf.close - end + + tf = Tempfile.new("partial") + tf.write "test" + tf.rewind + + output = @template_context.render_template_from_string("before {<%= render '#{tf.path}', :local => true %>} after") + expect(output).to eq("before {test} after") + ensure + tf.close + end it "should render partials from a different cookbook" do @@ -124,16 +124,16 @@ describe Chef::Mixin::Template, "render_template" do end it "should render using the source argument if provided" do - begin - tf = Tempfile.new("partial") - tf.write "test" - tf.rewind - - output = @template_context.render_template_from_string("before {<%= render 'something', :local => true, :source => '#{tf.path}' %>} after") - expect(output).to eq("before {test} after") - ensure - tf.close - end + + tf = Tempfile.new("partial") + tf.write "test" + tf.rewind + + output = @template_context.render_template_from_string("before {<%= render 'something', :local => true, :source => '#{tf.path}' %>} after") + expect(output).to eq("before {test} after") + ensure + tf.close + end it "should pass the node to partials" do @@ -195,11 +195,11 @@ describe Chef::Mixin::Template, "render_template" do describe "the raised TemplateError" do subject(:exception) do - begin - do_raise - rescue Chef::Mixin::Template::TemplateError => e - e - end + + do_raise + rescue Chef::Mixin::Template::TemplateError => e + e + end it "should contain template file and line numbers" do @@ -274,11 +274,11 @@ describe Chef::Mixin::Template, "render_template" do describe "the raised TemplateError" do before :each do - begin - do_raise - rescue Chef::Mixin::Template::TemplateError => e - @exception = e - end + + do_raise + rescue Chef::Mixin::Template::TemplateError => e + @exception = e + end it "should have the original exception" do diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb index 311d9ccea3..b2d64f44b2 100644 --- a/spec/unit/mixin/windows_architecture_helper_spec.rb +++ b/spec/unit/mixin/windows_architecture_helper_spec.rb @@ -50,10 +50,10 @@ describe Chef::Mixin::WindowsArchitectureHelper do it "raises an error if an invalid architecture is passed to assert_valid_windows_architecture!" do @invalid_architectures.each do |architecture| - begin - expect(assert_valid_windows_architecture!(architecture)).to raise_error Chef::Exceptions::Win32ArchitectureIncorrect - rescue Chef::Exceptions::Win32ArchitectureIncorrect - end + + expect(assert_valid_windows_architecture!(architecture)).to raise_error Chef::Exceptions::Win32ArchitectureIncorrect + rescue Chef::Exceptions::Win32ArchitectureIncorrect + end end diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 55a858ce04..ec7beb9a50 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1773,11 +1773,11 @@ describe Chef::Node do end let(:http_exception) do - begin - response.error! - rescue => e - e - end + + response.error! + rescue => e + e + end let(:trimmed_node) do diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb index f9559d8827..a845664a0d 100644 --- a/spec/unit/provider/remote_directory_spec.rb +++ b/spec/unit/provider/remote_directory_spec.rb @@ -201,17 +201,17 @@ describe Chef::Provider::RemoteDirectory do @fclass = Chef::CFCCheck.new Dir.mktmpdir do |tmp_dir| - begin - @fclass.file_class.symlink(tmp_dir.dup, symlinked_dir_path) - expect(::File.exist?(symlinked_dir_path)).to be_truthy - @provider.run_action + @fclass.file_class.symlink(tmp_dir.dup, symlinked_dir_path) + expect(::File.exist?(symlinked_dir_path)).to be_truthy + + @provider.run_action + + expect(::File.exist?(symlinked_dir_path)).to be_falsey + expect(::File.exist?(tmp_dir)).to be_truthy + rescue Chef::Exceptions::Win32APIError + skip "This must be run as an Administrator to create symlinks" - expect(::File.exist?(symlinked_dir_path)).to be_falsey - expect(::File.exist?(tmp_dir)).to be_truthy - rescue Chef::Exceptions::Win32APIError - skip "This must be run as an Administrator to create symlinks" - end end end end diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb index f4212e3a8d..20c07a5c45 100644 --- a/spec/unit/provider_resolver_spec.rb +++ b/spec/unit/provider_resolver_spec.rb @@ -54,11 +54,11 @@ describe Chef::ProviderResolver do let(:provider_resolver) { Chef::ProviderResolver.new(node, resource, action) } let(:resolved_provider) do - begin - resource ? resource.provider_for_action(action).class : nil - rescue Chef::Exceptions::ProviderNotFound - nil - end + + resource ? resource.provider_for_action(action).class : nil + rescue Chef::Exceptions::ProviderNotFound + nil + end let(:service_name) { "test" } |