Top Level Namespace

Defined Under Namespace

Modules: Puppet, PuppetlabsSpec, RSpec

Instance Method Summary collapse

Instance Method Details

#fixtures(category) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/puppet_module_spec_helper/rake_tasks.rb', line 24

def fixtures(category)
  begin
    fixtures = YAML.load_file(".fixtures.yml")["fixtures"]
  rescue Errno::ENOENT
    return {}
  end

  if not fixtures
    abort("malformed fixtures.yml")
  end

  result = {}
  if fixtures.include? category
    fixtures[category].each do |fixture, source|
      target = "spec/fixtures/modules/#{fixture}"
      real_source = eval('"'+source+'"')
      result[real_source] = target
    end
  end
  return result
end

#param_value(subject, type, title, param) ⇒ Object



4
5
6
# File 'lib/puppet_module_spec_helper/module_spec_helper.rb', line 4

def param_value(subject, type, title, param)
  subject.resource(type, title).send(:parameters)[param.to_sym]
end

#source_dirObject

This is a helper for the self-symlink entry of fixtures.yml



20
21
22
# File 'lib/puppet_module_spec_helper/rake_tasks.rb', line 20

def source_dir
  Dir.pwd
end

#verify_contents(subject, title, expected_lines) ⇒ Object



8
9
10
11
# File 'lib/puppet_module_spec_helper/module_spec_helper.rb', line 8

def verify_contents(subject, title, expected_lines)
  content = subject.resource('file', title).send(:parameters)[:content]
  (content.split("\n") & expected_lines).should == expected_lines
end