Module: RSpec::Core::Pending
- Included in:
- ExampleGroup
- Defined in:
- lib/rspec/core/pending.rb
Defined Under Namespace
Classes: PendingDeclaredInExample
Constant Summary
- NO_REASON_GIVEN =
'No reason given'
- NOT_YET_IMPLEMENTED =
'Not yet implemented'
Instance Method Summary (collapse)
-
- (Object) pending(*args)
Stops execution of an example, and reports it as pending.
Instance Method Details
- (Object) pending - (Object) pending(message) - (Object) pending(message, &block)
Note:
before(:each)
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
Stops execution of an example, and reports it as pending. Takes an optional message and block.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/rspec/core/pending.rb', line 74 def pending(*args) return self.class.before(:each) { pending(*args) } unless example = args.last.is_a?(Hash) ? args.pop : {} = args.first || NO_REASON_GIVEN if [:unless] || (.has_key?(:if) && ![:if]) return block_given? ? yield : nil end example.[:pending] = true example.[:execution_result][:pending_message] = example.execution_result[:pending_fixed] = false if block_given? begin result = begin yield example.example_group_instance.instance_eval { verify_mocks_for_rspec } true end example.[:pending] = false rescue Exception => e example.execution_result[:exception] = e ensure teardown_mocks_for_rspec end if result example.execution_result[:pending_fixed] = true raise PendingExampleFixedError.new end end raise PendingDeclaredInExample.new() end |