Skip to content

Commit

Permalink
get described_class to point to the right thing
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Feb 2, 2010
1 parent 8f53c52 commit 12615ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/rspec/core/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/rspec/core/example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/core/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 12615ba

Please sign in to comment.