diff options
author | Kris Shannon <k.shannon@amaze.com.au> | 2019-11-22 21:39:12 +1100 |
---|---|---|
committer | Kris Shannon <k.shannon@amaze.com.au> | 2019-11-22 21:39:12 +1100 |
commit | ae3930b699be1707d595743e77808548d98c0233 (patch) | |
tree | cbbe996144f46fb1a03baf784e24e33b31b69fc3 /spec | |
parent | 964903716867f6a1a09f4c6a3b270ef331c856c7 (diff) | |
download | ohai-ae3930b699be1707d595743e77808548d98c0233.tar.gz |
Extract `hex_to_dec_netmask` into mixin/network_helper.rb
Signed-off-by: Kris Shannon <k.shannon@amaze.com.au>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/mixin/network_helper_spec.rb | 30 | ||||
-rw-r--r-- | spec/unit/plugins/aix/network_spec.rb | 10 |
2 files changed, 30 insertions, 10 deletions
diff --git a/spec/unit/mixin/network_helper_spec.rb b/spec/unit/mixin/network_helper_spec.rb new file mode 100644 index 00000000..ec0b2472 --- /dev/null +++ b/spec/unit/mixin/network_helper_spec.rb @@ -0,0 +1,30 @@ +# +# Author:: Kris Shannon <k.shannon@amaze.com.au> +# Copyright:: Copyright (c) 2019 Amaze Communication. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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 "ohai/mixin/network_helper" + +describe Ohai::Mixin::NetworkHelper, "Network Helper Mixin" do + let(:mixin) { Object.new.extend(Ohai::Mixin::NetworkHelper) } + + describe "hex_to_dec_netmask method" do + it "converts a netmask from hexadecimal form to decimal form" do + expect(mixin.hex_to_dec_netmask("ffff0000")).to eq("255.255.0.0") + end + end +end diff --git a/spec/unit/plugins/aix/network_spec.rb b/spec/unit/plugins/aix/network_spec.rb index 9d408d94..e96db800 100644 --- a/spec/unit/plugins/aix/network_spec.rb +++ b/spec/unit/plugins/aix/network_spec.rb @@ -300,14 +300,4 @@ describe Ohai::System, "AIX network plugin" do expect(@plugin["network"]["arp"][0][:remote_mac]).to eq("6e:87:70:0:40:3") end end - - describe "hex_to_dec_netmask method" do - before do - @plugin.run - end - - it "converts a netmask from hexadecimal form to decimal form" do - expect(@plugin.hex_to_dec_netmask("ffff0000")).to eq("255.255.0.0") - end - end end |