Sha256: fb1796d00a81d0522a8330614222cc39e23276420bac33b40345584a2f3fd902

Contents?: true

Size: 1.05 KB

Versions: 41

Compression:

Stored size: 1.05 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

41 entries across 41 versions & 3 rubygems

Version Path
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/activesupport-3.0.0/lib/active_support/testing/pending.rb
activesupport-3.0.20 lib/active_support/testing/pending.rb
activesupport-3.0.19 lib/active_support/testing/pending.rb
activesupport-3.0.18 lib/active_support/testing/pending.rb
activesupport-3.0.17 lib/active_support/testing/pending.rb
activesupport-3.0.16 lib/active_support/testing/pending.rb
activesupport-3.0.15 lib/active_support/testing/pending.rb
activesupport-3.0.14 lib/active_support/testing/pending.rb
activesupport-3.0.13 lib/active_support/testing/pending.rb
activesupport-3.0.13.rc1 lib/active_support/testing/pending.rb
activesupport-3.0.12 lib/active_support/testing/pending.rb
activesupport-3.0.12.rc1 lib/active_support/testing/pending.rb
activesupport-3.0.11 lib/active_support/testing/pending.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/testing/pending.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/activesupport-3.0.9/lib/active_support/testing/pending.rb
activesupport-3.0.10 lib/active_support/testing/pending.rb
activesupport-3.0.10.rc1 lib/active_support/testing/pending.rb
activesupport-3.0.9 lib/active_support/testing/pending.rb
activesupport-3.0.9.rc5 lib/active_support/testing/pending.rb
activesupport-3.0.9.rc4 lib/active_support/testing/pending.rb