Module: Pears::Testing
- Defined in:
- lib/pears/testing.rb,
lib/pears/testing/subject.rb
Defined Under Namespace
Modules: Subject
Class Method Summary collapse
Class Method Details
.find_subject!(name) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pears/testing.rb', line 15 def self.find_subject!(name) Pears.subjects .find { |subject| subject.name.to_sym == name.to_sym }.tap do |sub| unless sub.present? raise SubjectNotfound.new( message: "No subject with the name #{subject_name} exists." ) end end end |
.prepend_subject(subject_name, *address, is:) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/pears/testing.rb', line 5 def self.prepend_subject subject_name, *address, is: subject = find_subject!(subject_name) subject.prepend *address, is: is begin yield ensure subject.shift end end |