Skip to content

Instantly share code, notes, and snippets.

@plukevdh
Created July 22, 2014 20:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plukevdh/a374b1ffaeb409e54fa7 to your computer and use it in GitHub Desktop.
Save plukevdh/a374b1ffaeb409e54fa7 to your computer and use it in GitHub Desktop.
escaped_path missing?
RSpec.configure do |config|
config.include InputExampleGroup, type: :input, example_group: {
file_path: config.escaped_path(%w[spec inputs])
}
end
@myronmarston
Copy link

escaped_path was a private API that we didn't realize anyone was using. It got removed in the changes that went into RSpec 3. Sorry about that. I've open up an issue so that we remember to add the missing deprecation to 2.99:

rspec/rspec-rails#1127

Anyhow, in RSpec 3, I'd recommend you configure that like so:

RSpec.configure do |config|
  config.include InputExampleGroup, type: :input
  config.define_derived_metadata(:file_path => /spec\/input/) do |metadata|
    metadata[:type] ||= :input
  end
end

escaped_path simply dealt with windows vs posix path separators. For your own use you don't really need it unless your spec suite needs to run on both types of OSs.

@plukevdh
Copy link
Author

Golden. I had assumed this was a private API but found it in use in our codebase during the upgrade and needed a way to correct. Magical hacks.

@cforcey
Copy link

cforcey commented Oct 31, 2014

Thanks for this gist -- got me out of a similar bind. Appreciate the revised method myronmarston!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment