lib/assert/context/subject_dsl.rb in assert-2.18.3 vs lib/assert/context/subject_dsl.rb in assert-2.18.4
- old
+ new
@@ -1,33 +1,32 @@
module Assert; end
-class Assert::Context
- module SubjectDSL
- # Add a piece of description text or return the full description for the context
- 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
+class Assert::Context; end
+module Assert::Context::SubjectDSL
+ # Add a piece of description text or return the full description for the context
+ 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
- alias_method :desc, :description
- alias_method :describe, :description
+ end
+ alias_method :desc, :description
+ alias_method :describe, :description
- def subject(&block)
- if block_given?
- @subject = block
- else
- @subject || if superclass.respond_to?(:subject)
- superclass.subject
- end
+ def subject(&block)
+ if block_given?
+ @subject = block
+ else
+ @subject || if superclass.respond_to?(:subject)
+ superclass.subject
end
end
+ end
- protected
+ protected
- def descriptions
- @descriptions ||= []
- end
+ def descriptions
+ @descriptions ||= []
end
end