From ef323e3b31172d82cf6a10baca5f8f4da106a38f Mon Sep 17 00:00:00 2001 From: Russell Seymour Date: Thu, 2 Mar 2017 14:08:33 +0000 Subject: [PATCH] Updated resource to follow RSpec convention Closes #31 Signed-off-by: Russell Seymour --- README.md | 2 +- docs/resources/azure_virtual_machine_datadisks.md | 6 +++--- libraries/azure_virtual_machine_datadisks.rb | 2 +- test/integration/azure/verify/controls/datadisks.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 02d8563ac..0e5a638fa 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ it { should have_boot_diagnostics } | Resource Name | Resources | Description | |---------------|-----------|-------------| -| azure_vm_datadisks | has_disks? | Boolean test to see if a machine has datadisks | +| azure_vm_datadisks | has_data_disks? | Boolean test to see if a machine has datadisks | | | count | Returns the number of data disks attached to the machine | | | where | Filter that allows for different tests to be performed, see examples below | diff --git a/docs/resources/azure_virtual_machine_datadisks.md b/docs/resources/azure_virtual_machine_datadisks.md index dc65f1339..6de0732bd 100644 --- a/docs/resources/azure_virtual_machine_datadisks.md +++ b/docs/resources/azure_virtual_machine_datadisks.md @@ -26,7 +26,7 @@ where * `MyResourceGroup` is the name of the resouce group that the machine is in. * `matcher` is one of - `count` the number of data disks attached to the machine - - `has_disks?` boolean test denoting if data disks are attached + - `has_data_disks?` boolean test denoting if data disks are attached - `entries` used with the `where` filter to check the size of a disk * `value` is the expected output fdrom the matcher @@ -48,12 +48,12 @@ Returns the number of data disks attached to the machine its('count') { should eq 1 } ``` -### has_disks? +### has_data_disks? Returns a boolean denoting if any data disks are attached to the machine ```ruby -its('has_disks?') { should be true } +it { should have_data_disks } ``` ### entries diff --git a/libraries/azure_virtual_machine_datadisks.rb b/libraries/azure_virtual_machine_datadisks.rb index 3c65b7aa2..3a600c9ee 100644 --- a/libraries/azure_virtual_machine_datadisks.rb +++ b/libraries/azure_virtual_machine_datadisks.rb @@ -69,7 +69,7 @@ class AzureVmDataDisks < Inspec.resource(1) # # @return [Boolean] States if the VM has any disks attached # - def has_disks? + def has_data_disks? !entries.empty? end diff --git a/test/integration/azure/verify/controls/datadisks.rb b/test/integration/azure/verify/controls/datadisks.rb index 69fffb4e7..00af1ba11 100644 --- a/test/integration/azure/verify/controls/datadisks.rb +++ b/test/integration/azure/verify/controls/datadisks.rb @@ -12,7 +12,7 @@ control 'azure-vm-datadisks-1.0' do # Ensure that the named machine has 1 data disk describe azure_virtual_machine_datadisks(name: vm_internal, resource_group: resource_group_name) do - its('has_disks?') { should be true } + it { should have_data_disks } its('count') { should eq 1 } end