module RSpec::Core::Pending
def self.const_missing(name)
def self.const_missing(name) return super unless name == :PendingDeclaredInExample RSpec.deprecate("RSpec::Core::PendingDeclaredInExample", :replacement => "RSpec::Core::Pending::SkipDeclaredInExample") SkipDeclaredInExample end
def pending(*args, &block)
- Note: - `before(:each)` hooks are eval'd when you use the `pending`
Parameters:
-
block
(Block
) -- optional block. If it fails, the example is -
message
(String
) -- optional message to add to the summary report.
Overloads:
-
pending(message, &block)
-
pending(message)
-
pending()
def pending(*args, &block) RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, '')) |The semantics of `RSpec::Core::Pending#pending` are changing in |RSpec 3. In RSpec 2.x, it caused the example to be skipped. In |RSpec 3, the rest of the example will still be run but is expected |to fail, and will be marked as a failure (rather than as pending) |if the example passes. | |Any passed block will no longer be executed. This feature is being |removed since it was semantically inconsistent, and the behaviour it |offered is being made available with the other ways of marking an |example pending. | |To keep the same skip semantics, change `pending` to `skip`. |Otherwise, if you want the new RSpec 3 behavior, you can safely |ignore this warning and continue to upgrade to RSpec 3 without |addressing it. | |Called from #{CallerFilter.first_non_rspec_line}. | EOS pending_no_warning(*args, &block) end
def pending_no_warning(*args)
def pending_no_warning(*args) return self.class.before(:each) { pending(*args) } unless RSpec.current_example options = args.last.is_a?(Hash) ? args.pop : {} message = args.first || NO_REASON_GIVEN if options[:unless] || (options.has_key?(:if) && !options[:if]) return block_given? ? yield : nil end RSpec.current_example.metadata[:pending] = true RSpec.current_example.metadata[:execution_result][:pending_message] = message RSpec.current_example.execution_result[:pending_fixed] = false if block_given? begin result = begin yield RSpec.current_example.example_group_instance.instance_eval { verify_mocks_for_rspec } end RSpec.current_example.metadata[:pending] = false rescue Exception => e RSpec.current_example.execution_result[:exception] = e ensure teardown_mocks_for_rspec end if result RSpec.current_example.execution_result[:pending_fixed] = true raise PendingExampleFixedError.new end end raise SkipDeclaredInExample.new(message) end
def skip(*args)
Backport from RSpec 3 to aid in upgrading.
def skip(*args) pending_no_warning(*args) end