Module: ChefSpec::API::SubversionMatchers

Defined in:
lib/chefspec/api/subversion.rb

Overview

Since:

  • 3.0.0

Instance Method Summary collapse

Instance Method Details

#checkout_subversion(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that a subversion resource exists in the Chef run with the action :checkout. Given a Chef Recipe that checks out “svn://…” as a subversion:

subversion 'svn://...' do
  action :checkout
end

The Examples section demonstrates the different ways to test a subversion resource with ChefSpec.

Examples:

Assert that a subversion was checked out

expect(chef_run).to checkout_subversion('svn://...')

Assert that a subversion was checked out with predicate matchers

expect(chef_run).to checkout_subversion('svn://...').with_user('svargo')

Assert that a subversion was checked out with attributes

expect(chef_run).to checkout_subversion('svn://...').with(user: 'svargo')

Assert that a subversion was checked out using a regex

expect(chef_run).to checkout_subversion('svn://...').with(user: /sva(.+)/)

Assert that a subversion was not checked out

expect(chef_run).to_not checkout_subversion('svn://...')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 3.0.0



39
40
41
# File 'lib/chefspec/api/subversion.rb', line 39

def checkout_subversion(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:subversion, :checkout, resource_name)
end

#export_subversion(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that a subversion resource exists in the Chef run with the action :export. Given a Chef Recipe that exports “svn://” as a subversion:

subversion 'svn://' do
  action :export
end

The Examples section demonstrates the different ways to test a subversion resource with ChefSpec.

Examples:

Assert that a subversion was exported

expect(chef_run).to export_subversion('svn://')

Assert that a subversion was exported with predicate matchers

expect(chef_run).to export_subversion('svn://').with_user('svargo')

Assert that a subversion was exported with attributes

expect(chef_run).to export_subversion('svn://').with(user: 'svargo')

Assert that a subversion was exported using a regex

expect(chef_run).to export_subversion('svn://').with(user: /sva(.+)/)

Assert that a subversion was not exported

expect(chef_run).to_not export_subversion('svn://')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 3.0.0



76
77
78
# File 'lib/chefspec/api/subversion.rb', line 76

def export_subversion(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:subversion, :export, resource_name)
end

#force_export_subversion(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that a subversion resource exists in the Chef run with the action :force_export. Given a Chef Recipe that force_exports “svn://” as a subversion:

subversion 'svn://' do
  action :force_export
end

The Examples section demonstrates the different ways to test a subversion resource with ChefSpec.

Examples:

Assert that a subversion was force_exported

expect(chef_run).to force_export_subversion('svn://')

Assert that a subversion was force_exported with predicate matchers

expect(chef_run).to force_export_subversion('svn://').with_user('svargo')

Assert that a subversion was force_exported with attributes

expect(chef_run).to force_export_subversion('svn://').with(user: 'svargo')

Assert that a subversion was force_exported using a regex

expect(chef_run).to force_export_subversion('svn://').with(user: /sva(.+)/)

Assert that a subversion was not force_exported

expect(chef_run).to_not force_export_subversion('svn://')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 3.0.0



113
114
115
# File 'lib/chefspec/api/subversion.rb', line 113

def force_export_subversion(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:subversion, :force_export, resource_name)
end

#sync_subversion(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher

Assert that a subversion resource exists in the Chef run with the action :sync. Given a Chef Recipe that syncs “svn://” as a subversion:

subversion 'svn://' do
  action :sync
end

The Examples section demonstrates the different ways to test a subversion resource with ChefSpec.

Examples:

Assert that a subversion was synced

expect(chef_run).to sync_subversion('svn://')

Assert that a subversion was synced with predicate matchers

expect(chef_run).to sync_subversion('svn://').with_user('svargo')

Assert that a subversion was synced with attributes

expect(chef_run).to sync_subversion('svn://').with(user: 'svargo')

Assert that a subversion was synced using a regex

expect(chef_run).to sync_subversion('svn://').with(user: /sva(.+)/)

Assert that a subversion was not synced

expect(chef_run).to_not sync_subversion('svn://')

Parameters:

  • resource_name (String, Regex)

    the name of the resource to match

Returns:

Since:

  • 3.0.0



150
151
152
# File 'lib/chefspec/api/subversion.rb', line 150

def sync_subversion(resource_name)
  ChefSpec::Matchers::ResourceMatcher.new(:subversion, :sync, resource_name)
end