module RSpec::SleepingKingStudios::Concerns::SharedExampleGroup
Methods for creating reusable shared example groups and shared contexts in a module that can be mixed into multiple RSpec
example groups.
@example
module MySharedExamples extend RSpec::SleepingKingStudios::Concerns::SharedExampleGroup shared_examples 'my examples' do # Define shared examples here. end # shared_examples end # module RSpec.describe MyObject do include MySharedExamples include_examples 'my examples' end # describe
Public Instance Methods
Source
# File lib/rspec/sleeping_king_studios/concerns/shared_example_group.rb, line 50 def included other super merge_shared_example_groups other end
@api private
Hook to merge defined example groups when included in another module.
Calls superclass method
Private Instance Methods
Source
# File lib/rspec/sleeping_king_studios/concerns/shared_example_group.rb, line 82 def example_group_definition example_group if example_group.is_a?(Proc) example_group elsif defined?(RSpec::Core::SharedExampleGroupModule) && example_group.is_a?(RSpec::Core::SharedExampleGroupModule) example_group.definition else nil end # if-elsif-else end