Module: Assert::Context::SubjectDSL
- Included in:
- Assert::Context
- Defined in:
- lib/assert/context/subject_dsl.rb
Instance Method Summary collapse
-
#description(text = nil) ⇒ Object
(also: #desc, #describe)
Add a piece of description text or return the full description for the context.
- #subject(&block) ⇒ Object
Instance Method Details
#description(text = nil) ⇒ Object Also known as: desc, describe
Add a piece of description text or return the full description for the context
7 8 9 10 11 12 13 14 15 |
# File 'lib/assert/context/subject_dsl.rb', line 7 def description(text = nil) if text self.descriptions << text.to_s else parent = self.superclass.desc if self.superclass.respond_to?(:desc) own = self.descriptions [parent, *own].compact.reject(&:empty?).join(" ") end end |
#subject(&block) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/assert/context/subject_dsl.rb', line 19 def subject(&block) if block_given? @subject = block else @subject || if superclass.respond_to?(:subject) superclass.subject end end end |