Module: CLIntegracon::Adapter::Bacon
- Included in:
- Bacon::Context
- Defined in:
- lib/CLIntegracon/adapter/bacon.rb
Overview
Define concrete adapter
Defined Under Namespace
Modules: Context
Instance Method Summary collapse
-
#describe_cli(subject_name, context_options = {}, &block) ⇒ Object
Describe a command line interface This method basically behaves like Bacon::Context.describe, but it provides automatically the methods #subject, #file_tree_spec_context, #cli_spec and #file_spec.
Instance Method Details
#describe_cli(subject_name, context_options = {}, &block) ⇒ Object
Describe a command line interface This method basically behaves like Bacon::Context.describe, but it provides automatically the methods #subject, #file_tree_spec_context, #cli_spec and #file_spec.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/CLIntegracon/adapter/bacon.rb', line 182 def describe_cli(subject_name, = {}, &block) context = describe subject_name do # Make Context methods available # WORKAROUND: Bacon auto-inherits singleton methods to child contexts # by using the runtime and won't include methods in modules included # by the parent context. We have to ensure that the methods will be # accessible by the child contexts by defining them as singleton methods. extended = self.extend Context Context.instance_methods.each do |method| class << self; self end.instance_eval do unbound_method = extended.method(method).unbind send :define_method, method do |*args, &b| unbound_method.bind(self).call(*args, &b) end end end subject do |s| s.name = subject_name s.executable = [:executable] || subject_name end instance_eval &block end Bacon::ErrorLog.gsub! %r{^.*lib/CLIntegracon/.*\n}, '' context end |