On Mon, Dec 3, 2012 at 7:57 AM, Jakub Arnold <[email protected]> wrote:
> Is there a better way to access DATA from inside a spec file than as
> described in this thread? http://www.ruby-forum.com/topic/1154214
>
> The solution they talk about is doing
> File.read(__FILE__).split("__END__\n")[-1]
>
> To me it seems like having a support for this might be useful in cases when
> you're building something like a parser, or anything related to a larger
> config file.
>
> What do you think guys?

I don't know what we'd do differently besides wrapping that line in a
method, but we'd be introducing an abstraction for something that
isn't all that common, can be solved in a number of different ways
already, and would likely confuse things by working differently than a
core Ruby concept.

Personally, I'm perfectly happy with using HERE docs if I want to keep
the text local, or loading up files explicitly when I don't need to
see what's in them to understand the test.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to