I’m writing some specs that test the template files in a gem that has generators for Rails. I’d love to access to “admin_layout.html.erb” in the rspec spec below:
require 'spec_helper'
describe "admin_layout.html.erb" do
it "has page title Admin" do
HERES WHERE I WOULD LOVE TO HAVE ACCESS TO "admin_layout.html.erb" AS A VARIABLE
end
end
You can use
self.class.descriptionto get this info:However, keep in mind this will only put out the first parent’s description. So if you have contexts in your
describeblock, then the examples within the contexts would give the context name forself.classinstead of thedescribeblock’s name. In that case, you could use metadata:In case you want the top-level description, you can use
self.class.top_level_description: