Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Cola
9,584 PointsMy deprecation message is much longer and more complex. Doing what the video says doesn't work.
message: RSpec::Core::ExampleGroup#example is deprecated and will be removed in RSpec 3. There are a few options for what you can use instead: -rspec-core's DSL methods('iti', 'before', 'after', 'let', 'subject', etc) now yield the example as a block argument, and that is the recommended way to access the current example from those contexts. -The current example is now exposed via 'RSpec.current_example', which is accessible from any context.
Along with other text. What can I do to get rid of these deprecations?
John Simoneau
Courses Plus Student 8,105 PointsThanks Adam Shields , that message was driving me nuts. Not sure if it really mattered if it was fixed or not to follow along with the video but certainly makes it a nicer experience to not have depreciation messages repeatedly. Thanks again :)
4 Answers
Jim Withington
12,025 PointsThanks Adam Shields ! That worked for me!
David Ker
14,439 PointsFor readability, it's probably a good idea to put config.expose_current_running_example_as :example
on it's own line. I put it at the bottom of the file, on line 63, but you can put it at the top on line 21. Usually not recommended to put it on the same line as do |config|
.
The short answer to why it works is...because the error message said so! It looks like Capybara is using old RSpec syntax.
Alex Cevallos
16,551 PointsAdam Shields Any clue as to why that fix worked ?
Robbie Schneider
25,712 PointsWas getting the same messaging, following David's suggestion by placing at the bottom of the spec_helper.rb file with a comment.
Adam Shields
4,573 PointsAdam Shields
4,573 PointsMichael, You need to modify the spec_helpers.rb file. The actual path to the file would be ODOT/spec/spec_helper.rb and the config change that I added to get rid of the long deprecation messages was right after the
RSpec.configure do |config|
I added
config.expose_current_running_example_as :example
so the completed syntax looks like
RSpec.configure do |config| config.expose_current_running_example_as :example
this is all on line #20 of the ODOT/spec/spec_helper.rb