RSpec / RSpec Core / Docs / Metadata
current example
You can reference the example object, and access its metadata, using the example method within an example.
Scenario: access the example object from within an example
- Given a file named "
spec/example_spec.rb" with:rubydescribe "an example" do it "knows itself as example" do example.description.should eq("knows itself as example") end end - When I run `rspec spec/example_spec.rb`
- Then the example should pass
Source: features/metadata/current_example.feature at v2.9.0, RSpec Core (MIT license).