def get_ancestor(ancestor_type)
      target_type = {:directory => [Directory],
                     :feature_file => [FeatureFile],
                     :feature => [Feature],
                     :test => [Scenario, Outline, Background],
                     :background => [Background],
                     :scenario => [Scenario],
                     :outline => [Outline],
                     :step => [Step],
                     :table => [Table],
                     :example => [Example],
                     :row => [Row]
      }[ancestor_type]

      raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_type.nil?


      ancestor = self.parent_model

      until target_type.include?(ancestor.class) || ancestor.nil?
        ancestor = ancestor.parent_model
      end


      ancestor
    end
def get_ancestor(ancestor_type)
      target_type = {:directory => [Directory],
                     :feature_file => [FeatureFile],
                     :feature => [Feature],
                     :test => [Scenario, Outline, Background],
                     :background => [Background],
                     :scenario => [Scenario],
                     :outline => [Outline],
                     :step => [Step],
                     :table => [Table],
                     :example => [Example],
                     :row => [Row]
      }[ancestor_type]

      raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_type.nil?


      ancestor = self.parent_model

      until target_type.include?(ancestor.class) || ancestor.nil?
        ancestor = ancestor.parent_model
      end


      ancestor
    end
Returns the ancestor model of this model that matches the given type.