Module: Sus::Describe
- Extended by:
- Context
- Defined in:
- lib/sus/describe.rb
Instance Attribute Summary collapse
-
#subject ⇒ Object
Returns the value of attribute subject.
Attributes included from Context
#children, #description, #identity
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Context
add, after, around, before, call, describe, each, empty?, extended, file, full_name, include_context, inspect, it, it_behaves_like, leaf?, let, set_temporary_name, to_s, with
Instance Attribute Details
#subject ⇒ Object
Returns the value of attribute subject.
12 13 14 |
# File 'lib/sus/describe.rb', line 12 def subject @subject end |
Class Method Details
.build(parent, subject, unique: true, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sus/describe.rb', line 14 def self.build(parent, subject, unique: true, &block) base = Class.new(parent) base.singleton_class.prepend(Describe) base.children = Hash.new base.subject = subject base.description = subject.to_s base.identity = Identity.nested(parent.identity, base.description, unique: unique) base.set_temporary_name("#{self}[#{base.description}]") base.define_method(:subject, ->{subject}) if block_given? base.class_exec(&block) end return base end |
Instance Method Details
#print(output) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/sus/describe.rb', line 32 def print(output) output.write( "describe ", :describe, self.description, :reset, # " ", self.identity.to_s ) end |