Module: Cheffish::RSpec::ChefRunSupport::ChefRunSupportInstanceMethods
- Defined in:
- lib/cheffish/rspec/chef_run_support.rb
Instance Method Summary collapse
- #basic_chef_client ⇒ Object
- #chef_client ⇒ Object
- #chef_config ⇒ Object
- #chef_run ⇒ Object
- #converge ⇒ Object
- #event_sink ⇒ Object
- #expect_recipe(&recipe) ⇒ Object
- #get(path, *args) ⇒ Object
- #load_recipe(&recipe) ⇒ Object
- #recipe(&recipe) ⇒ Object
- #reset_chef_client ⇒ Object
- #rest ⇒ Object
- #run_recipe(&recipe) ⇒ Object
Instance Method Details
#basic_chef_client ⇒ Object
83 84 85 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 83 def basic_chef_client chef_client.client end |
#chef_client ⇒ Object
70 71 72 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 70 def chef_client @chef_client ||= ChefRunWrapper.new(chef_config) end |
#chef_config ⇒ Object
58 59 60 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 58 def chef_config {} end |
#chef_run ⇒ Object
74 75 76 77 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 74 def chef_run converge if !chef_client.converged? event_sink.events end |
#converge ⇒ Object
101 102 103 104 105 106 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 101 def converge if chef_client.converged? raise "Already converged! Cannot converge twice, that's bad mojo." end chef_client.converge end |
#event_sink ⇒ Object
79 80 81 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 79 def event_sink chef_client.event_sink end |
#expect_recipe(&recipe) ⇒ Object
62 63 64 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 62 def expect_recipe(&recipe) expect(recipe(&recipe)) end |
#get(path, *args) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 51 def get(path, *args) if path[0] == '/' path = URI.join(rest.url, path) end rest.get(path, *args) end |
#load_recipe(&recipe) ⇒ Object
87 88 89 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 87 def load_recipe(&recipe) chef_client.client.load_block(&recipe) end |
#recipe(&recipe) ⇒ Object
66 67 68 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 66 def recipe(&recipe) RecipeRunWrapper.new(chef_config, &recipe) end |
#reset_chef_client ⇒ Object
96 97 98 99 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 96 def reset_chef_client @event_sink = nil @basic_chef_client = nil end |
#rest ⇒ Object
47 48 49 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 47 def rest ::Chef::ServerAPI.new end |
#run_recipe(&recipe) ⇒ Object
91 92 93 94 |
# File 'lib/cheffish/rspec/chef_run_support.rb', line 91 def run_recipe(&recipe) load_recipe(&recipe) converge end |