Module: RSpec::Core::Pending

### Home Classes Methods

### In Files

- lib/rspec/core/pending.rb

### Namespace

- CLASS RSpec::Core::Pending::PendingExampleFixedError
- CLASS RSpec::Core::Pending::SkipDeclaredInExample

### Methods

- ::mark_fixed!
- ::mark_pending!
- ::mark_skipped!
- #pending
- #skip

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Core
- RSpec::Core::AnonymousExampleGroup
- RSpec::Core::BacktraceFormatter
- RSpec::Core::Bisect
- RSpec::Core::Bisect::Coordinator
- RSpec::Core::Bisect::ExampleMinimizer
- RSpec::Core::Bisect::Runner
- RSpec::Core::Bisect::Server
- RSpec::Core::Bisect::SubsetEnumerator
- RSpec::Core::Configuration
- RSpec::Core::Configuration::DeprecationReporterBuffer
- RSpec::Core::Configuration::ExposeCurrentExample
- RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError
- RSpec::Core::ConfigurationOptions
- RSpec::Core::DRbOptions
- RSpec::Core::DRbRunner
- RSpec::Core::DSL
- RSpec::Core::DSL::RSpec
- RSpec::Core::Example
- RSpec::Core::Example::ExecutionResult
- RSpec::Core::Example::Procsy
- RSpec::Core::ExampleGroup
- RSpec::Core::ExampleStatusDumper
- RSpec::Core::ExampleStatusMerger
- RSpec::Core::ExampleStatusParser
- RSpec::Core::ExampleStatusPersister
- RSpec::Core::ExclusionRules
- RSpec::Core::FilterManager
- RSpec::Core::FilterRules
- RSpec::Core::FilterableItemRepository
- RSpec::Core::FilterableItemRepository::QueryOptimized
- RSpec::Core::FilterableItemRepository::UpdateOptimized
- RSpec::Core::FlatMap
- RSpec::Core::Formatters
- RSpec::Core::Formatters::BaseFormatter
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec::Core::Formatters::BisectDebugFormatter
- RSpec::Core::Formatters::BisectFormatter
- RSpec::Core::Formatters::BisectProgressFormatter
- RSpec::Core::Formatters::ConsoleCodes
- RSpec::Core::Formatters::DeprecationFormatter
- RSpec::Core::Formatters::DeprecationFormatter::DelayedPrinter
- RSpec::Core::Formatters::DeprecationFormatter::FileStream
- RSpec::Core::Formatters::DeprecationFormatter::ImmediatePrinter
- RSpec::Core::Formatters::DeprecationFormatter::RaiseErrorStream
- RSpec::Core::Formatters::DocumentationFormatter
- RSpec::Core::Formatters::ExceptionPresenter
- RSpec::Core::Formatters::ExceptionPresenter::Factory
- RSpec::Core::Formatters::ExceptionPresenter::Factory::CommonBacktraceTruncater
- RSpec::Core::Formatters::ExceptionPresenter::Factory::EmptyBacktraceFormatter
- RSpec::Core::Formatters::FallbackMessageFormatter
- RSpec::Core::Formatters::Helpers
- RSpec::Core::Formatters::HtmlFormatter
- RSpec::Core::Formatters::HtmlPrinter
- RSpec::Core::Formatters::JsonFormatter
- RSpec::Core::Formatters::Loader
- RSpec::Core::Formatters::ProfileFormatter
- RSpec::Core::Formatters::ProgressFormatter
- RSpec::Core::Formatters::Protocol
- RSpec::Core::Formatters::SnippetExtractor
- RSpec::Core::Formatters::SnippetExtractor::CoderayConverter
- RSpec::Core::Formatters::SnippetExtractor::NullConverter
- RSpec::Core::HashImitatable
- RSpec::Core::HashImitatable::ClassMethods
- RSpec::Core::Hooks
- RSpec::Core::Hooks::AfterContextHook
- RSpec::Core::Hooks::AfterHook
- RSpec::Core::Hooks::AroundHook
- RSpec::Core::Hooks::BeforeHook
- RSpec::Core::Hooks::Hook
- RSpec::Core::Hooks::HookCollections
- RSpec::Core::InclusionRules
- RSpec::Core::LegacyExampleGroupHash
- RSpec::Core::MemoizedHelpers
- RSpec::Core::MemoizedHelpers::ClassMethods
- RSpec::Core::MemoizedHelpers::ContextHookMemoized
- RSpec::Core::MemoizedHelpers::ContextHookMemoized::After
- RSpec::Core::MemoizedHelpers::ContextHookMemoized::Before
- RSpec::Core::MemoizedHelpers::NonThreadSafeMemoized
- RSpec::Core::MemoizedHelpers::ThreadsafeMemoized
- RSpec::Core::Metadata
- RSpec::Core::Metadata::ExampleGroupHash
- RSpec::Core::Metadata::ExampleHash
- RSpec::Core::Metadata::HashPopulator
- RSpec::Core::MetadataFilter
- RSpec::Core::MinitestAssertionsAdapter
- RSpec::Core::MockingAdapters
- RSpec::Core::MockingAdapters::Flexmock
- RSpec::Core::MockingAdapters::Mocha
- RSpec::Core::MockingAdapters::Null
- RSpec::Core::MockingAdapters::RR
- RSpec::Core::MockingAdapters::RSpec
- RSpec::Core::MultipleExceptionError
- RSpec::Core::MultipleExceptionError::InterfaceTag
- RSpec::Core::Mutex
- RSpec::Core::Notifications
- RSpec::Core::Notifications::CustomNotification
- RSpec::Core::Notifications::DeprecationNotification
- RSpec::Core::Notifications::ExampleNotification
- RSpec::Core::Notifications::ExamplesNotification
- RSpec::Core::Notifications::FailedExampleNotification
- RSpec::Core::Notifications::NullColorizer
- RSpec::Core::Notifications::NullNotification
- RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification
- RSpec::Core::Notifications::PendingExampleFixedNotification
- RSpec::Core::Notifications::ProfileNotification
- RSpec::Core::Notifications::SeedNotification
- RSpec::Core::Notifications::SkippedExampleNotification
- RSpec::Core::Notifications::SummaryNotification
- RSpec::Core::NullReporter
- RSpec::Core::Ordering
- RSpec::Core::Ordering::ConfigurationManager
- RSpec::Core::Ordering::Custom
- RSpec::Core::Ordering::Identity
- RSpec::Core::Ordering::Random
- RSpec::Core::Ordering::Registry
- RSpec::Core::Parser
- RSpec::Core::Pending
- RSpec::Core::Pending::PendingExampleFixedError
- RSpec::Core::Pending::SkipDeclaredInExample
- RSpec::Core::Profiler
- RSpec::Core::ProjectInitializer
- RSpec::Core::RakeTask
- RSpec::Core::ReentrantMutex
- RSpec::Core::Reporter
- RSpec::Core::RubyProject
- RSpec::Core::Runner
- RSpec::Core::Sandbox
- RSpec::Core::Set
- RSpec::Core::SharedContext
- RSpec::Core::SharedExampleGroup
- RSpec::Core::SharedExampleGroup::Registry
- RSpec::Core::SharedExampleGroup::TopLevelDSL
- RSpec::Core::SharedExampleGroupInclusionStackFrame
- RSpec::Core::SharedExampleGroupModule
- RSpec::Core::ShellEscape
- RSpec::Core::SuiteHookContext
- RSpec::Core::TestUnitAssertionsAdapter
- RSpec::Core::Time
- RSpec::Core::Version
- RSpec::Core::Warnings
- RSpec::Core::World
- RSpec::ExampleGroups
- Object

No matching classes.

# RSpec::Core::Pending

Provides methods to mark examples as pending. These methods are available to be called from within any example or hook.

### Constants

NOT_YET_IMPLEMENTED

  @private

NO_REASON_GIVEN

  @private

### Public Class Methods

mark_fixed!(example) click to toggle source

@private

Mark example as fixed.

@param example [RSpec::Core::Example] the example to mark as fixed

    # File lib/rspec/core/pending.rb, line 160
    def self.mark_fixed!(example)
      example.execution_result.pending_fixed = true
    end

mark_pending!(example, message_or_bool) click to toggle source

@private

Mark example as pending.

@param example [RSpec::Core::Example] the example to mark as pending @param message_or_bool [Boolean, String] the message to use, or true

    # File lib/rspec/core/pending.rb, line 143
    def self.mark_pending!(example, message_or_bool)
      message = if !message_or_bool || !(String === message_or_bool)
                  NO_REASON_GIVEN
                else
                  message_or_bool
                end

      example.metadata[:pending] = true
      example.execution_result.pending_message = message
      example.execution_result.pending_fixed = false
    end

mark_skipped!(example, message_or_bool) click to toggle source

@private

Mark example as skipped.

@param example [RSpec::Core::Example] the example to mark as skipped @param message_or_bool [Boolean, String] the message to use, or true

    # File lib/rspec/core/pending.rb, line 132
    def self.mark_skipped!(example, message_or_bool)
      Pending.mark_pending! example, message_or_bool
      example.metadata[:skip] = true
    end

### Public Instance Methods

pending(message=nil) click to toggle source

@overload pending() @overload pending(message)

Marks an example as pending. The rest of the example will still be executed, and if it passes the example will fail to indicate that the pending can be removed.

@param message [String] optional message to add to the summary report.

@example

    describe "an example" do
      # reported as "Pending: no reason given"
      it "is pending with no message" do
        pending
        raise "broken"
      end

      # reported as "Pending: something else getting finished"
      it "is pending with a custom message" do
        pending("something else getting finished")
        raise "broken"
      end
    end

@note `before(:example)` hooks are eval'd when you use the `pending`

    method within an example. If you want to declare an example `pending`
    and bypass the `before` hooks as well, you can pass `:pending => true`
    to the `it` method:

        it "does something", :pending => true do
          # ...
        end

    or pass `:pending => "something else getting finished"` to add a
    message to the summary report:

        it "does something", :pending => "something else getting finished" do
          # ...
        end

    # File lib/rspec/core/pending.rb, line 70
    def pending(message=nil)
      current_example = RSpec.current_example

      if block_given?
        raise ArgumentError,             |The semantics of `RSpec::Core::Pending#pending` have changed in            |RSpec 3. In RSpec 2.x, it caused the example to be skipped. In            |RSpec 3, the rest of the example is still run but is expected to            |fail, and will be marked as a failure (rather than as pending) if            |the example passes.            |            |Passing a block within an example is now deprecated. Marking the            |example as pending provides the same behavior in RSpec 3 which was            |provided only by the block in RSpec 2.x.            |            |Move the code in the block provided to `pending` into the rest of            |the example body.            |            |Called from #{CallerFilter.first_non_rspec_line}.            |.gsub(/^\s+\|/, '')
      elsif current_example
        Pending.mark_pending! current_example, message
      else
        raise "`pending` may not be used outside of examples, such as in "                  "before(:context). Maybe you want `skip`?"
      end
    end

skip(message=nil) click to toggle source

@overload skip() @overload skip(message)

Marks an example as pending and skips execution.

@param message [String] optional message to add to the summary report.

@example

    describe "an example" do
      # reported as "Pending: no reason given"
      it "is skipped with no message" do
        skip
      end

      # reported as "Pending: something else getting finished"
      it "is skipped with a custom message" do
        skip "something else getting finished"
      end
    end

    # File lib/rspec/core/pending.rb, line 118
    def skip(message=nil)
      current_example = RSpec.current_example

      Pending.mark_skipped!(current_example, message) if current_example

      raise SkipDeclaredInExample.new(message)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.