Consider this (simplified) snippet. RSpec 3.1.7
RSpec.describe MyController, :type => :controller do
describe "PUT #update" do
before(:example) do
puts self.class #=>
RSpec::ExampleGroups::MyController::PUTUpdate
puts self.class.example.description #=> "example at
./spec/controllers/my_controller_spec.rb:xxx"
puts self.class.example.full_description #=> "MyController PUT update"
puts example.description #=> undefined local variable
or method 'example'
end
it "should update things" do
puts self.class #=>
RSpec::ExampleGroups::MyController::PUTUpdate
puts self.class.example.description #=> "example at
./spec/controllers/my_controller_spec.rb:xxx"
puts self.class.example.full_description #=> "MyController PUT update"
puts example.description #=> undefined local variable
or method 'example'
end
end
end
I'm seeing some odd results when getting the metadata and description
values for examples.
None of the Example instance methods work. Everything behaves as an
ExampleGroup. I'm not sure if this is intended.
>From the rspec-core README https://github.com/rspec/rspec-core#metadata
it "does something" do
expect(example.metadata[:description]).to eq("does something")
end
This does not work. Am I doing something wrong?
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/6650454c-35da-44e4-bad7-e33ecc02f912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.