Sha256: 71a5b88bbb37207dc58509641a349a629d4c2df3cf31c4b41cd9eec2a79e8eb6

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

namespace :coulda do
  desc "Print all features as plain text"
  task :print_features do

    $LOAD_PATH.unshift("test")

    require 'test/unit'

    # bug in test unit.  Set to true to stop from running.
    Test::Unit.run = true

    test_files = Dir.glob(File.join('test', '**', '*_feature.rb'))
    test_files.each do |file|
      load file
    end

    ObjectSpace.each_object do |obj|
      next unless obj.is_a? Feature

      puts "Feature: #{obj.name}"
      puts "  In order to #{obj.in_order_to}" if obj.in_order_to
      puts "  As a #{obj.as_a}" if obj.as_a
      puts "  I want to #{obj.i_want_to}" if obj.i_want_to
      obj.scenarios.each do |scenario|
        puts
        puts "  Scenario: #{scenario.name} #{scenario.pending? ? '(pending)' : ''}"
        scenario.statements.each do |stmt|
          puts "    #{stmt[:type].to_s} #{stmt[:text]}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coulda-0.4.3 lib/coulda/tasks/print_features.rake