Class | Spec::Example::SharedExampleGroup |
In: |
lib/spec/example/shared_example_group.rb
|
Parent: | Module |
# File lib/spec/example/shared_example_group.rb, line 5 5: def add_shared_example_group(new_example_group) 6: guard_against_redefining_existing_example_group(new_example_group) 7: shared_example_groups << new_example_group 8: end
# File lib/spec/example/shared_example_group.rb, line 10 10: def find_shared_example_group(example_group_description) 11: shared_example_groups.find do |b| 12: b.description == example_group_description 13: end 14: end
# File lib/spec/example/shared_example_group.rb, line 39 39: def initialize(*args, &example_group_block) 40: describe(*args) 41: @example_group_block = example_group_block 42: self.class.add_shared_example_group(self) 43: end
# File lib/spec/example/shared_example_group.rb, line 16 16: def shared_example_groups 17: # TODO - this needs to be global, or at least accessible from 18: # from subclasses of Example in a centralized place. I'm not loving 19: # this as a solution, but it works for now. 20: $shared_example_groups ||= [] 21: end