Sha256: c25b07cbd5e8f4f707e5f938401f75b9d7c49b1caa9074edcf3ac4a02a97dea2

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

# Some code from jeremymcanally's "pending"
# http://github.com/jeremymcanally/pending/tree/master

module ActiveSupport
  module Testing
    module Pending

      unless defined?(Spec)

        @@pending_cases = []
        @@at_exit = false

        def pending(description = "", &block)
          if description.is_a?(Symbol)
            is_pending = $tags[description]
            return block.call unless is_pending
          end

          if block_given?
            failed = false

            begin
              block.call
            rescue Exception
              failed = true
            end

            flunk("<#{description}> did not fail.") unless failed 
          end

          caller[0] =~ (/(.*):(.*):in `(.*)'/)
          @@pending_cases << "#{$3} at #{$1}, line #{$2}"
          print "P"
      
          @@at_exit ||= begin
            at_exit do
              puts "\nPending Cases:"
              @@pending_cases.each do |test_case|
                puts test_case
              end
            end
          end
        end
      end
      
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
activesupport-3.0.0.rc lib/active_support/testing/pending.rb
csd-0.1.5 lib/active_support/testing/pending.rb
csd-0.1.4 lib/active_support/testing/pending.rb
csd-0.1.3 lib/active_support/testing/pending.rb
csd-0.1.2 lib/active_support/testing/pending.rb
csd-0.1.1 lib/active_support/testing/pending.rb
csd-0.1.0 lib/active_support/testing/pending.rb
csd-0.0.16 lib/active_support/testing/pending.rb
activesupport-3.0.0.beta4 lib/active_support/testing/pending.rb
activesupport-3.0.0.beta3 lib/active_support/testing/pending.rb
activesupport-3.0.0.beta2 lib/active_support/testing/pending.rb
activesupport-3.0.0.beta lib/active_support/testing/pending.rb
activesupport-3.0.pre lib/active_support/testing/pending.rb
recliner-0.0.1 vendor/activesupport/lib/active_support/testing/pending.rb