On Sat, Feb 18, 2012 at 7:06 PM, S Ahmed
<sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> My spec folder is setup like this:
>
> /spec
> /spec/spec_helper.rb
> /spec/lib
> /spec/lib/some_file_spec.rb
>
> My some_file_spec.rb has:
>
> require ''spec_helper''
>
> describe "......." do
>
> end
>
>
> Why does this work even though the spec_helper file is in a folder below
> the actual file I am writing the specs for?
>
> What techniques are there to include files? I see this also:
>
You could change your spec file to:
require ''spec_helper''
puts $LOAD_PATH
describe "..." do
and study the output of that puts.
In my case, rather near the end of the list, it has:
/home/peterv/.../<Rails.root>/spec
which explains why the `require` finds the spec_helper.rb file there.
HTH,
Peter
--
*** Available for a new project ***
Peter Vandenabeele
http://twitter.com/peter_v
http://rails.vandenabeele.com
http://coderwall.com/peter_v
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.