Permalink
Browse files

removed some unused code in TestCase, and noticed that mocks aren't w…

…orking properly
  • Loading branch information...
1 parent c3c208d commit 8e3901d57549dd50e0f21f805584360c621cf2fe @glv committed Sep 13, 2010
Showing with 28 additions and 7 deletions.
  1. +0 −6 lib/rspec/unit/test_case.rb
  2. +28 −1 spec/test_case_spec.rb
@@ -18,8 +18,6 @@ class TestCase < RSpec::Core::ExampleGroup
alias_example_to :test, :test_unit => true
- @configuration = RSpec.configuration
-
def self.inherited(klass)
super
@@ -56,10 +54,6 @@ def self.ancestors
super[0..-2]
end
- def self.to_s
- self == ::RSpec::Unit::TestCase ? 'RSpec::Unit::TestCase' : super
- end
-
def self.test_case_name(klass)
class_name = klass.name
(class_name.nil? || class_name.empty?) ? '<Anonymous TestCase>' : class_name
View
@@ -106,6 +106,7 @@ def test_bar; end
describe "running test methods" do
it "runs the test methods as examples" do
+ pending "RSpec is not properly checking mock expectations"
use_formatter(@formatter) do
@foo.class_eval do
def test_bar; end
@@ -116,6 +117,7 @@ def test_bar; end
end
it "brackets test methods with setup/teardown" do
+ pending "RSpec is not properly checking mock expectations"
use_formatter(@formatter) do
@foo.class_eval do
def test_bar; end
@@ -133,6 +135,29 @@ def test_baz; end
end
end
+ it "only calls setup/teardown once per test in subclasses" do
+ pending "RSpec is not properly checking mock expectations"
+ isolate_example_group do
+ @foo.class_eval do
+ def test_baz; end
+ end
+ bar = Class.new(@foo)
+ bar.class_eval do
+ def test_quux; end
+ end
+
+ bar.should_receive(:setup) .once
+ bar.should_receive(:test_baz) .once
+ bar.should_receive(:teardown) .once
+ bar.should_receive(:setup) .once
+ bar.should_receive(:test_quux).once
+ bar.should_receive(:teardown) .once
+
+ run_tests(bar)
+ end
+ end
+
+
it "records failed tests in RSpec style" do
use_formatter(@formatter) do
@foo.class_eval do
@@ -198,7 +223,7 @@ class SampleTestCase < RSpec::Unit::TestCase
@bar.ancestors.should == [@bar, @foo]
end
end
-
+
describe "test class metadata" do
sandboxed do
class SampleTestCaseForName < RSpec::Unit::TestCase
@@ -361,6 +386,7 @@ def test_quux; end
end
it "allows defining 'before' blocks" do
+ pending "RSpec is not properly checking mock expectations"
use_formatter(@formatter) do
@foo.class_eval do
before {bar}
@@ -373,6 +399,7 @@ def test_bar; end
end
it "allows defining 'after' blocks" do
+ pending "RSpec is not properly checking mock expectations"
use_formatter(@formatter) do
@foo.class_eval do
after {bar}

0 comments on commit 8e3901d

Please sign in to comment.