diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 12:03:20 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 12:57:40 -0700 |
commit | 8215091264d67d81f0da9a13f968b864ff736cb2 (patch) | |
tree | 37b71de99d1190c9c24e63fbbc50610363b7b8d5 /spec | |
parent | 7bf98ad06b30b7feb4ea3fbbe45a5b733467a5d3 (diff) | |
download | chef-8215091264d67d81f0da9a13f968b864ff736cb2.tar.gz |
Style/ClassCheck
convert kind_of? to is_a?
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/link_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/api_client/registration_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/decorator_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/knife_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/lwrp_spec.rb | 10 | ||||
-rw-r--r-- | spec/unit/node_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/recipe_spec.rb | 4 |
7 files changed, 15 insertions, 15 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index d86a904098..4593dc1971 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -133,9 +133,9 @@ describe Chef::Resource::Link do end def get_sid(value) - if value.kind_of?(String) + if value.is_a?(String) Chef::ReservedNames::Win32::Security::SID.from_account(value) - elsif value.kind_of?(Chef::ReservedNames::Win32::Security::SID) + elsif value.is_a?(Chef::ReservedNames::Win32::Security::SID) value else raise "Must specify username or SID: #{value}" diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb index 6fd1d4d0e1..3e786c3c02 100644 --- a/spec/unit/api_client/registration_spec.rb +++ b/spec/unit/api_client/registration_spec.rb @@ -98,7 +98,7 @@ describe Chef::ApiClient::Registration do it "has an HTTP client configured with validator credentials" do expect(registration.http_api).to be_a_kind_of(Chef::ServerAPI) expect(registration.http_api.options[:client_name]).to eq("test-validator") - auth = registration.http_api.middlewares.find { |klass| klass.kind_of? Chef::HTTP::Authenticator } + auth = registration.http_api.middlewares.find { |klass| klass.is_a? Chef::HTTP::Authenticator } expect(auth.client_name).to eq("test-validator") end diff --git a/spec/unit/decorator_spec.rb b/spec/unit/decorator_spec.rb index 6d73db2cc4..80bbd73bdf 100644 --- a/spec/unit/decorator_spec.rb +++ b/spec/unit/decorator_spec.rb @@ -28,11 +28,11 @@ def impersonates_a(klass) end it "#kind_of?(#{klass}) is true" do - expect(decorator.kind_of?(klass)).to be true + expect(decorator.is_a?(klass)).to be true end it "#kind_of?(Chef::Decorator) is true" do - expect(decorator.kind_of?(Chef::Decorator)).to be true + expect(decorator.is_a?(Chef::Decorator)).to be true end it "#instance_of?(#{klass}) is false" do diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 70e4091847..bab6b579b5 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -205,7 +205,7 @@ describe Chef::Knife do KnifeSpecs.send :remove_const, :TestYourself end Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb")) - Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.kind_of?(Class) } + Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.is_a?(Class) } end it "confirms that the headers include X-Remote-Request-Id" do @@ -220,7 +220,7 @@ describe Chef::Knife do KnifeSpecs.send :remove_const, :TestYourself end Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb")) - Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.kind_of?(Class) } + Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.is_a?(Class) } end it "merges the global knife CLI options" do diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index 68db44e537..5c1bdb687c 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -590,7 +590,7 @@ describe "LWRP" do it "get_lwrp(:lwrp_once).new is an instance of the LWRP class" do lwrp = get_lwrp(:lwrp_once).new("hi") - expect(lwrp.kind_of?(test_lwrp_class)).to be_truthy + expect(lwrp.is_a?(test_lwrp_class)).to be_truthy expect(lwrp.is_a?(test_lwrp_class)).to be_truthy expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy expect(test_lwrp_class === lwrp).to be_truthy @@ -603,28 +603,28 @@ describe "LWRP" do it "subclass.new is a subclass" do lwrp = subclass.new("hi") - expect(lwrp.kind_of?(subclass)).to be_truthy + expect(lwrp.is_a?(subclass)).to be_truthy expect(lwrp.is_a?(subclass)).to be_truthy expect(subclass === lwrp).to be_truthy expect(lwrp.class === subclass) end it "subclass.new is an instance of the LWRP class" do lwrp = subclass.new("hi") - expect(lwrp.kind_of?(test_lwrp_class)).to be_truthy + expect(lwrp.is_a?(test_lwrp_class)).to be_truthy expect(lwrp.is_a?(test_lwrp_class)).to be_truthy expect(test_lwrp_class === lwrp).to be_truthy expect(lwrp.class === test_lwrp_class) end it "subclass.new is a get_lwrp(:lwrp_once)" do lwrp = subclass.new("hi") - expect(lwrp.kind_of?(get_lwrp(:lwrp_once))).to be_truthy + expect(lwrp.is_a?(get_lwrp(:lwrp_once))).to be_truthy expect(lwrp.is_a?(get_lwrp(:lwrp_once))).to be_truthy expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy expect(lwrp.class === get_lwrp(:lwrp_once)) end it "get_lwrp(:lwrp_once).new is *not* a subclass" do lwrp = get_lwrp(:lwrp_once).new("hi") - expect(lwrp.kind_of?(subclass)).to be_falsey + expect(lwrp.is_a?(subclass)).to be_falsey expect(lwrp.is_a?(subclass)).to be_falsey expect(subclass === lwrp.class).to be_falsey expect(subclass === get_lwrp(:lwrp_once)).to be_falsey diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 0fe375a4df..c170d4730e 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1385,7 +1385,7 @@ describe Chef::Node do describe "inflated" do it "should return a hash of node names and objects" do n1 = double("Chef::Node", name: "one") - allow(n1).to receive(:kind_of?).with(Chef::Node) { true } + allow(n1).to receive(:is_a?).with(Chef::Node) { true } expect(@query).to receive(:search).with(:node).and_yield(n1) r = Chef::Node.list(true) expect(r["one"]).to eq(n1) diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 1bc84745ad..a4fdbd9809 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -115,7 +115,7 @@ describe Chef::Recipe do node.automatic[:platform_version] = "123" res = recipe.laughter "timmy" expect(res.name).to eql("timmy") - res.kind_of?(ShaunTheSheep) + res.is_a?(ShaunTheSheep) end it "locate a resource for all platforms" do @@ -124,7 +124,7 @@ describe Chef::Recipe do YourMom.provides :love_and_caring res = recipe.love_and_caring "mommy" expect(res.name).to eql("mommy") - res.kind_of?(YourMom) + res.is_a?(YourMom) end describe "when there is more than one resource that resolves on a node" do |