Module: ChefSpec::API::Described
- Defined in:
- lib/chefspec/api/described.rb
Instance Method Summary collapse
-
#described_cookbook ⇒ String
The name of the currently running cookbook spec.
-
#described_recipe ⇒ String
The name of the currently running recipe spec.
Instance Method Details
#described_cookbook ⇒ String
The name of the currently running cookbook spec. Given the top-level describe
block is of the format:
describe 'my_cookbook::my_recipe' do
# ...
end
The value of described_cookbook
is “my_cookbook”.
22 23 24 |
# File 'lib/chefspec/api/described.rb', line 22 def described_cookbook described_recipe.split("::").first end |
#described_recipe ⇒ String
The name of the currently running recipe spec. Given the top-level describe
block is of the format:
describe 'my_cookbook::my_recipe' do
# ...
end
The value of described_recipe
is “my_cookbook::my_recipe”.
42 43 44 45 46 47 48 49 |
# File 'lib/chefspec/api/described.rb', line 42 def described_recipe scope = is_a?(Class) ? self : self.class = scope. = [:parent_example_group] while .key?(:parent_example_group) [:description].to_s end |