lib/micronaut/behaviour.rb in spicycode-micronaut-0.1.0 vs lib/micronaut/behaviour.rb in spicycode-micronaut-0.1.1

- old
+ new

@@ -4,10 +4,15 @@ def self.inherited(klass) super Micronaut::World.behaviour_groups << klass end + + def self.extended_modules #:nodoc: + ancestors = class << self; ancestors end + ancestors.select { |mod| mod.class == Module } - [ Object, Kernel ] + end def self.befores @_befores ||= { :all => [], :each => [] } end @@ -52,11 +57,15 @@ metadata[:described_type] = args.first.is_a?(String) ? self.superclass.described_type : args.shift metadata[:description] = args.shift || '' metadata[:name] = "#{metadata[:described_type]} #{metadata[:description]}".strip Micronaut.configuration.find_modules(self).each do |include_or_extend, mod, opts| - send(include_or_extend, mod) + if include_or_extend == :extend + send(:extend, mod) unless extended_modules.include?(mod) + else + send(:include, mod) unless included_modules.include?(mod) + end end end def self.metadata @_metadata ||= {} @@ -142,10 +151,9 @@ return true if examples.empty? reporter.add_behaviour(self) group = new - eval_before_alls(group) success = true examples.each do |ex| reporter.example_started(ex) \ No newline at end of file