Permalink
Browse files

remove :disabled (redundant with :pending)

- add example for pending
  • Loading branch information...
1 parent e5d88ee commit 8f53c5219be931144ff5fdab646005394751912b @dchelimsky dchelimsky committed Feb 2, 2010
Showing with 24 additions and 5 deletions.
  1. +1 −3 lib/rspec/core/example.rb
  2. +4 −2 lib/rspec/core/example_group.rb
  3. +19 −0 spec/rspec/core/pending_example_spec.rb
View
4 lib/rspec/core/example.rb
@@ -82,9 +82,7 @@ def run
end
def runnable?
- ![example_block.nil?,
- metadata[:disabled] == true,
- metadata[:pending] == true ].any?
+ !metadata[:pending]
end
def run(example_group_instance)
View
6 lib/rspec/core/example_group.rb
@@ -22,13 +22,16 @@ def self.extended_modules #:nodoc:
end
def self.example(desc=nil, options={}, &block)
- examples << Rspec::Core::Example.new(self, desc, options.update(:caller => caller), block)
+ options.update(:pending => true) unless block
+ options.update(:caller => caller)
+ examples << Rspec::Core::Example.new(self, desc, options, block)
end
def self.alias_example_to(new_alias, extra_options={})
new_alias = <<-END_RUBY
def self.#{new_alias}(desc=nil, options={}, &block)
updated_options = options.update(:caller => caller)
+ updated_options.update(:pending => true) unless block
updated_options.update(#{extra_options.inspect})
examples << Rspec::Core::Example.new(self, desc, updated_options, block)
end
@@ -39,7 +42,6 @@ def self.#{new_alias}(desc=nil, options={}, &block)
alias_example_to :it
alias_example_to :specify
alias_example_to :focused, :focused => true
- alias_example_to :disabled, :disabled => true
alias_example_to :pending, :pending => true
def self.it_should_behave_like(*names)
View
19 spec/rspec/core/pending_example_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+Rspec::Matchers.define :be_pending do
+ match do |example|
+ example.metadata[:pending]
+ end
+end
+
+describe "an example" do
+ context "with no block" do
+ it "is listed as pending" do
+ group = isolated_example_group do
+ it "has no block"
+ end
+ group.run(stub('reporter').as_null_object)
+ group.examples.first.should be_pending
+ end
+ end
+end

0 comments on commit 8f53c52

Please sign in to comment.