Module | Spec::DSL::BehaviourCallbacks |
In: |
lib/spec/dsl/behaviour_callbacks.rb
|
# File lib/spec/dsl/behaviour_callbacks.rb, line 30 30: def add(scope, options, where, how, &block) 31: scope ||= :each 32: options ||= {} 33: behaviour_type = options[:behaviour_type] 34: case scope 35: when :each; self.__send__("#{where}_each_parts", behaviour_type).__send__(how, block) 36: when :all; self.__send__("#{where}_all_parts", behaviour_type).__send__(how, block) 37: end 38: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 20 20: def append_after(*args, &block) 21: scope, options = scope_and_options(*args) 22: add(scope, options, :after, :<<, &block) 23: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 9 9: def append_before(*args, &block) 10: scope, options = scope_and_options(*args) 11: add(scope, options, :before, :<<, &block) 12: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 15 15: def prepend_after(*args, &block) 16: scope, options = scope_and_options(*args) 17: add(scope, options, :after, :unshift, &block) 18: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 5 5: def prepend_before(*args, &block) 6: scope, options = scope_and_options(*args) 7: add(scope, options, :before, :unshift, &block) 8: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 40 40: def remove_after(scope, &block) 41: after_each_parts.delete(block) 42: end
# File lib/spec/dsl/behaviour_callbacks.rb, line 25 25: def scope_and_options(*args) 26: args, options = args_and_options(*args) 27: scope = (args[0] || :each), options 28: end