Permalink
Browse files

move PendingExampleFixedError to RSpec::Core::Pending

  • Loading branch information...
1 parent 59602fa commit b5d10ccbe3a590adc67d807acb565be3657e51bf @dchelimsky dchelimsky committed Dec 12, 2011
View
@@ -38,7 +38,6 @@ def require_rspec(path)
require_rspec 'core/shared_example_group'
require_rspec 'core/example_group'
require_rspec 'core/version'
-require_rspec 'core/errors'
module RSpec
autoload :Matchers, 'rspec/matchers'
View
@@ -1,13 +0,0 @@
-module RSpec
- module Core
- # If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
- # will report unmet RSpec expectations as failures rather than errors.
- begin
- class PendingExampleFixedError < Test::Unit::AssertionFailedError; end
- rescue
- class PendingExampleFixedError < StandardError; end
- end
- end
-end
-
-
@@ -159,7 +159,7 @@ def dump_backtrace(example)
end
def dump_pending_example_fixed(example, index)
- if RSpec::Core::PendingExampleFixedError === example.execution_result[:exception]
+ if RSpec::Core::Pending::PendingExampleFixedError === example.execution_result[:exception]
output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED"
output.puts blue("#{long_padding}Expected pending '#{example.metadata[:execution_result][:pending_message]}' to fail. No Error was raised.")
true
@@ -75,7 +75,7 @@ def example_failed(example)
super(example)
exception = example.metadata[:execution_result][:exception]
extra = extra_failure_content(exception)
- failure_style = RSpec::Core::PendingExampleFixedError === exception ? 'pending_fixed' : 'failed'
+ failure_style = RSpec::Core::Pending::PendingExampleFixedError === exception ? 'pending_fixed' : 'failed'
@output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>" unless @header_red
@header_red = true
@output.puts " <script type=\"text/javascript\">makeRed('div_group_#{example_group_number}');</script>" unless @example_group_red
View
@@ -3,6 +3,14 @@ module Core
module Pending
class PendingDeclaredInExample < StandardError; end
+ # If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
+ # will report unmet RSpec expectations as failures rather than errors.
+ begin
+ class PendingExampleFixedError < Test::Unit::AssertionFailedError; end
+ rescue
+ class PendingExampleFixedError < StandardError; end
+ end
+
DEFAULT_MESSAGE = 'No reason given'
# @overload pending()
@@ -79,7 +87,7 @@ def pending(*args)
ensure
teardown_mocks_for_rspec
end
- raise RSpec::Core::PendingExampleFixedError.new if result
+ raise PendingExampleFixedError.new if result
end
raise PendingDeclaredInExample.new(message)
end
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
./spec/rspec/core/formatters/html_formatter_spec.rb:24
./spec/rspec/core/formatters/html_formatter_spec.rb:46
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `(root)'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `Formatters'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `Formatters'
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a>
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a>
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a>
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
@@ -318,7 +318,7 @@
<span class="failed_spec_name">fails</span>
<span class="duration">n.nnnns</span>
<div class="failure" id="failure_1">
- <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
@@ -150,15 +150,15 @@ def run_example(*pending_args)
context "when given no options" do
it "fails with a PendingExampleFixedError" do
- run_example("just because").should fail_with(RSpec::Core::PendingExampleFixedError)
- run_example.should fail_with(RSpec::Core::PendingExampleFixedError)
+ run_example("just because").should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+ run_example.should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
end
end
context "when given a truthy :if option" do
it "fails with a PendingExampleFixedError" do
- run_example("just because", :if => true).should fail_with(RSpec::Core::PendingExampleFixedError)
- run_example( :if => true).should fail_with(RSpec::Core::PendingExampleFixedError)
+ run_example("just because", :if => true).should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+ run_example( :if => true).should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
end
end
@@ -178,8 +178,8 @@ def run_example(*pending_args)
context "when given a falsey :unless option" do
it "fails with a PendingExampleFixedError" do
- run_example("just because", :unless => false).should fail_with(RSpec::Core::PendingExampleFixedError)
- run_example( :unless => false).should fail_with(RSpec::Core::PendingExampleFixedError)
+ run_example("just because", :unless => false).should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+ run_example( :unless => false).should fail_with(RSpec::Core::Pending::PendingExampleFixedError)
end
end
end

0 comments on commit b5d10cc

Please sign in to comment.