Permalink
Browse files

get described_class to point to the right thing

  • Loading branch information...
1 parent 8f53c52 commit 12615bab475c5d95dfb88e4ba4df3532b1970342 @dchelimsky dchelimsky committed Feb 2, 2010
Showing with 6 additions and 6 deletions.
  1. +0 −4 lib/rspec/core/example.rb
  2. +4 −0 lib/rspec/core/example_group.rb
  3. +2 −2 spec/rspec/core/example_spec.rb
View
4 lib/rspec/core/example.rb
@@ -13,10 +13,6 @@ def description
@metadata[:description]
end
- def described_class
- @metadata[:describes]
- end
-
def record_results(results={})
@metadata[:execution_result].update(results)
end
View
4 lib/rspec/core/example_group.rb
@@ -209,6 +209,10 @@ def assignments
@assignments ||= {}
end
+ def described_class
+ running_example.metadata[:behaviour][:describes]
+ end
+
def __reset__
instance_variables.each { |ivar| remove_instance_variable(ivar) }
assignments.clear
View
4 spec/rspec/core/example_spec.rb
@@ -43,8 +43,8 @@
end
describe '#described_class' do
- it "is a shortcut to ...." do
- @example.described_class.should == @example.metadata[:describes]
+ it "returns the class (if any) of the outermost example group" do
+ described_class.should == Rspec::Core::Example
end
end

0 comments on commit 12615ba

Please sign in to comment.