Sha256: 4e8f2096ad463be1d4e4bc0ffab43d72ea545ac0822b380c325252d3760d0caa

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 KB

Contents

module RSpec
  module Core
    module Pending
      class PendingDeclaredInExample < StandardError; end

      DEFAULT_MESSAGE = 'No reason given'

      def pending(*args)
        return self.class.before(:each) { pending(*args) } unless example

        options = args.last.is_a?(Hash) ? args.pop : {}
        message = args.first || DEFAULT_MESSAGE

        if options[:unless] || (options.has_key?(:if) && !options[:if])
          return block_given? ? yield : nil
        end

        example.metadata[:pending] = true
        example.metadata[:execution_result][:pending_message] = message
        if block_given?
          begin
            result = begin
                       yield
                       example.example_group_instance.instance_eval { verify_mocks_for_rspec }
                     end
            example.metadata[:pending] = false
          rescue Exception => e
            example.execution_result[:exception] = e
          ensure
            teardown_mocks_for_rspec
          end
          raise RSpec::Core::PendingExampleFixedError.new if result
        end
        raise PendingDeclaredInExample.new(message)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.5 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.4 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.3 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.2 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
nutshell-crm-0.0.1 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/pending.rb
rspec-core-2.7.1 lib/rspec/core/pending.rb
rspec-core-2.7.0 lib/rspec/core/pending.rb
rspec-core-2.7.0.rc1 lib/rspec/core/pending.rb