Sha256: 544e63ff2687f5598cce6e4b8205ff8dbe817a6e162520545ef36deb2635e9cc

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

module Approvals
  module Namers
    class DirectoryNamer < RSpecNamer

      def initialize(example)
        @name = directorize example
      end

      private

      def directorize(example)
        parts     = [ ]
        metadata  = example.metadata

        approvals_path = lambda do |metadata|
          description = normalize metadata[:description]
          example_group = if metadata.key?(:example_group)
                            metadata[:example_group]
                          else
                            metadata[:parent_example_group]
                          end

          if example_group
            [approvals_path[example_group], description].join('/')
          else
            description
          end
        end

        approvals_path[example.metadata]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
approvals-0.0.20 lib/approvals/namers/directory_namer.rb
approvals-0.0.19 lib/approvals/namers/directory_namer.rb
approvals-0.0.18 lib/approvals/namers/directory_namer.rb
approvals-0.0.17 lib/approvals/namers/directory_namer.rb