Running rspec in spec/requests directory with cells fails

Hi, not exactly sure if this is a cells bug or an rspec (or both), but
when running a simple request spec
from the spec/requests directory gets an error whereas running it from
the RAILS ROOT directory it works…
Seems it cannot find the view in the cells directory.

The full project is in GitHub - wolfmanjm/wolfmanblog_rails: Wolfman blog ported to rails 3.
Using rails 3.0.3 and rspec-rails 2.2.1

cd spec/request
rspec basics_spec.rb

[sequel] Setting up the “test” environment:
F

Failures:

  1. Basic tests works! (now write some real specs)
    Failure/Error: visit “/”
    Missing template cell/rails/google_search with
    {:locale=>[:en, :en], :handlers=>[:haml, :rjs, :rhtml, :rxml, :erb,
    :builder], :formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss,
    :atom, :yaml, :multipart_form, :url_encoded_form, :json]}
    in view paths “/home/morris/work/ruby/rails3/wolfmanblog/spec/requests/
    app/cells”, “/home/morris/work/ruby/rails3/wolfmanblog/spec/requests/
    app/cells/layouts” and possible paths sidebar/google_searchcell/rails/
    google_search

    /home/morris/work/ruby/rails3/wolfmanblog/app/cells/

sidebar_cell.rb:8:in google_search' # /home/morris/work/ruby/rails3/wolfmanblog/app/helpers/ application_helper.rb:3:in sidebar’
# /home/morris/work/ruby/rails3/wolfmanblog/app/views/layouts/
application.html.haml:34:in
`_app_views_layouts_application_html_haml__882586219_84745880_0’
# ./basics_spec.rb:5

Finished in 0.14442 seconds
1 example, 1 failure

On Dec 22, 2010, at 2:51 AM, Jim M. wrote:

Hi, not exactly sure if this is a cells bug or an rspec (or both), but
when running a simple request spec
from the spec/requests directory gets an error whereas running it from
the RAILS ROOT directory it works…
Seems it cannot find the view in the cells directory.

The full project is in GitHub - wolfmanjm/wolfmanblog_rails: Wolfman blog ported to rails 3.
Using rails 3.0.3 and rspec-rails 2.2.1

cd spec/request

Try running from the project root instead:

$ rspec spec/requests/basics_spec.rb

or

$ rspec spec/requests

or

$ rake spec:requests

HTH,
David

{:locale=>[:en, :en], :handlers=>[:haml, :rjs, :rhtml, :rxml, :erb, :builder],
:formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml,
:multipart_form, :url_encoded_form, :json]}
`_app_views_layouts_application_html_haml__882586219_84745880_0’
# ./basics_spec.rb:5

Finished in 0.14442 seconds
1 example, 1 failure


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Cheers,
David

Yes it works from ROOT as I said in original post :slight_smile:

However I can run normal request specs from the request directory
itself, if they don’t use cells.

Is rspec meant to only run from ROOT?

Also this part of the error message seems suspicious…

and possible paths sidebar/google_searchcell/rails/google_search

Seems to have concatenated two paths into one.

The reason I am asking is because the rspec-mode for emacs runs its
specs from the directory the spec you are testing resides.
I’ll need to fix that if rspec is not meant to be run from there.

Thanks

On Dec 22, 2010, at 1:44 PM, Jim M. wrote:

Yes it works from ROOT as I said in original post :slight_smile:

Oops. Missed that.

However I can run normal request specs from the request directory
itself, if they don’t use cells.

Is rspec meant to only run from ROOT?

Yes. You can get it to work elsewhere, but you have to do some fun
things w/ the LOAD_PATH to do it.

Also this part of the error message seems suspicious…

and possible paths sidebar/google_searchcell/rails/google_search

Seems to have concatenated two paths into one.

The reason I am asking is because the rspec-mode for emacs runs its
specs from the directory the spec you are testing resides.
I’ll need to fix that if rspec is not meant to be run from there.

Yeah, that’s the case.

Cheers,
David