On 25 Feb 2011, at 00:26, Shamaoke wrote:
> Thanks for the explanations, Costi G. I didn't thought that the `DATA`
> constant isn't seen by the interpreter if it is in the required file.
>
> The only solution that I can think of right now is the following:
Why not just File.read(DATA_FILE) and
Thanks for the explanations, Costi G. I didn't thought that the `DATA`
constant isn't seen by the interpreter if it is in the required file.
The only solution that I can think of right now is the following:
~~~
# data_spec.rb
describe 'DATA' do
it 'contains lines following the __END__ keyword'
P. A. wrote in post #983523:
> Hi.
>
> In Ruby there's the `DATA` constant which contains the lines following
> the `__END__` keyword in the source file. For some reason RSpec
> doesn't see it.
>
> Here's the example:
>
> ~~~
> # data_spec.rb
>
> requre 'rspec'
>
> describe 'DATA' do
> it 'contai
Hi.
In Ruby there's the `DATA` constant which contains the lines following
the `__END__` keyword in the source file. For some reason RSpec
doesn't see it.
Here's the example:
~~~
# data_spec.rb
requre 'rspec'
describe 'DATA' do
it 'contains lines following the __END__ keyword' do
DATA.re