spec/unit/command/verify_spec.rb in chef-dk-1.2.22 vs spec/unit/command/verify_spec.rb in chef-dk-1.3.40

- old
+ new

@@ -13,12 +13,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # -require 'spec_helper' -require 'chef-dk/command/verify' +require "spec_helper" +require "chef-dk/command/verify" module Gem # We stub Gem.ruby because `verify` uses it to locate the omnibus directory, # but we also use it in some of the "test commands" in these tests. @@ -78,17 +78,17 @@ allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby")) expect(command_instance.omnibus_apps_dir).to include("eg_omnibus_dir/valid/embedded") end it "should raise OmnibusInstallNotFound if directory is not looking like omnibus" do - allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,".rbenv/versions/2.1.1/bin/ruby")) - expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound) + allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, ".rbenv/versions/2.1.1/bin/ruby")) + expect { command_instance.omnibus_apps_dir }.to raise_error(ChefDK::OmnibusInstallNotFound) end it "raises OmnibusInstallNotFound if omnibus directory doesn't exist" do - allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,"eg_omnibus_dir/missing_apps/embedded/bin/ruby")) - expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound) + allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/missing_apps/embedded/bin/ruby")) + expect { command_instance.omnibus_apps_dir }.to raise_error(ChefDK::OmnibusInstallNotFound) end context "and a component's gem is not installed" do before do component_map = ChefDK::Command::Verify.component_map.dup @@ -96,12 +96,12 @@ component_map["cucumber"].gem_base_dir = "cucumber" allow(ChefDK::Command::Verify).to receive(:component_map).and_return(component_map) end it "raises MissingComponentError when a component doesn't exist" do - allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,"eg_omnibus_dir/missing_component/embedded/bin/ruby")) - expect{command_instance.validate_components!}.to raise_error(ChefDK::MissingComponentError) + allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/missing_component/embedded/bin/ruby")) + expect { command_instance.validate_components! }.to raise_error(ChefDK::MissingComponentError) end end end describe "when running verify command" do @@ -109,14 +109,14 @@ let(:ruby_path) { File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby") } def run_unit_test # Set rubyopt to empty to prevent bundler from infecting the ruby # subcommands (and loading a bunch of extra gems). - lambda { |_self| sh("#{Gem.real_ruby} verify_me", env: { "RUBYOPT" => ""}) } + lambda { |_self| sh("#{Gem.real_ruby} verify_me", env: { "RUBYOPT" => "" }) } end def run_integration_test - lambda { |_self| sh("#{Gem.real_ruby} integration_test", env: { "RUBYOPT" => ""}) } + lambda { |_self| sh("#{Gem.real_ruby} integration_test", env: { "RUBYOPT" => "" }) } end let(:all_tests_ok) do ChefDK::ComponentTest.new("successful_comp").tap do |c| c.base_dir = "embedded/apps/berkshelf"