Module: RSpec::WithArgs::ClassMethodExampleGroup
Class Method Summary collapse
- .included(base) ⇒ Object
- .set_subject_method_name(metadata) ⇒ Object
- .set_subject_proc(metadata) ⇒ Object
Instance Method Summary collapse
Methods included from CommonClassMethods
Methods included from CommonInstanceMethods
Class Method Details
.included(base) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/with_args.rb', line 78 def self.included(base) set_subject_proc(base.) set_subject_method_name(base.) base.subject do instance_eval &subject_proc end end |
.set_subject_method_name(metadata) ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/with_args.rb', line 96 def self.set_subject_method_name() case d = [:example_group][:description_args].first when is_a?(Class) [:subject_method_name] = d when /^[.#]/ [:subject_method_name] = d.gsub /^[.#]/, "" end end |
.set_subject_proc(metadata) ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/with_args.rb', line 87 def self.set_subject_proc() [:subject_proc] = proc do |x| described_class.send( subject_method_name, *subject_args.map{|a| send(a)} ) end end |
Instance Method Details
#subject_method_name ⇒ Object
109 110 111 |
# File 'lib/with_args.rb', line 109 def subject_method_name [:subject_method_name] end |
#subject_proc ⇒ Object
105 106 107 |
# File 'lib/with_args.rb', line 105 def subject_proc [:subject_proc] end |