Closed olerass closed 10 years ago
It sounds like source caching may be turned off. Normally it is enabled, but perhaps the spec helper file is explicitly disabling it.
Try adding the following line to the spec helper (or even your test file):
Given.source_caching_disabled = false
I could not reproduce your problem from the description (without explicitly disabling source caching).
Thanks! Given.source_caching_disabled = false
in spec_helper.rb
solves the problem, but I have no idea why. It would be nice if it worked out of the box though.
Looks like source caching is enabled if the output format requires it. Can you put the following in your spec_helper and let me know what it says...
RSpec.configure do |c|
puts "RSPEC FORMATTERS: #{c.formatters}"
end
In the end, perhaps I should just default to always enabled rather than trying to do any fancy format sensing.
Output:
RSPEC FORMATTERS: []
Doesn't look that interesting I'm afraid :-(
No, actually that's quite helpful. I'm trying to guess the default value of source caching from the type of formatter used. Evidently, there are no formatters configured when given is configured, so it is guessing incorrectly.
Version 3.5.3 (just pushed) now makes a hard default to enable source caching.
Thanks for the feedback.
In a project with the following structure:
If rspec-given is required in
spec_helper
thenrspec -fd
outputs the source file and line instead of the correct string (Then {...}
) in the test case run: