Sha256: bce2ac8563b1215e10dac14432937daa132a7b8d3f6703ede2a943bb4396983f
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
module AssemblyLine class Constructor extend Forwardable def_delegators :rspec_context, :let, :before attr_reader :name, :code_block, :rspec_context, :options def initialize(name, code_block) @name = name @code_block = code_block end def assemble(context, options) @options = options @rspec_context = context instance_eval(&code_block) self end def invoke(*methods) if methods.any? invoke_in_setup *methods else invoke_in_setup name end end def depends_on(*constructors) if options[:depends_on] constructors = Array(options[:depends_on]) end constructors.each do |name| AssemblyLine.assemble(name, rspec_context) end end protected def invoke_in_setup(*methods) before(:all) do methods.each do |method_name| send(method_name) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
assembly_line-0.2.0 | lib/assembly_line/constructor.rb |
assembly_line-0.1.0 | lib/assembly_line/constructor.rb |