Class: Foodtaster::RSpec::ExampleMethods::ChefConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/foodtaster/rspec/example_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChefConfig



34
35
36
37
# File 'lib/foodtaster/rspec/example_methods.rb', line 34

def initialize
  @json = {}
  @run_list = []
end

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



32
33
34
# File 'lib/foodtaster/rspec/example_methods.rb', line 32

def json
  @json
end

#run_listObject

Returns the value of attribute run_list.



32
33
34
# File 'lib/foodtaster/rspec/example_methods.rb', line 32

def run_list
  @run_list
end

Instance Method Details

#add_recipe(name) ⇒ Object



39
40
41
42
# File 'lib/foodtaster/rspec/example_methods.rb', line 39

def add_recipe(name)
  name = "recipe[#{name}]" unless name =~ /^recipe\[(.+?)\]$/
  run_list << name
end

#add_role(name) ⇒ Object



44
45
46
47
# File 'lib/foodtaster/rspec/example_methods.rb', line 44

def add_role(name)
  name = "role[#{name}]" unless name =~ /^role\[(.+?)\]$/
  run_list << name
end

#to_hashObject



49
50
51
# File 'lib/foodtaster/rspec/example_methods.rb', line 49

def to_hash
  { json: json, run_list: run_list }
end