Note that there are some explanatory texts on larger screens.

plurals
  1. POrspec ignores skip_before_filter?
    primarykey
    data
    text
    <p>We are having a strange problem. In the application controller we have a <code>before_filter</code> set that requires authentication using <code>devise</code> and redirects if needed to the login page. </p> <p>In our library controller we skip this <code>before_filter</code>. </p> <pre><code>skip_before_filter :authenticate_user!, :only =&gt; :show </code></pre> <p>When we run a simple functional test with <code>capybara</code> and <code>rspec</code> the test fails. </p> <pre><code>it "should get only english articles within the category 'computers'" do visit '/en/library/computers' page.should have_content('computers') end </code></pre> <p>It looks like it doesn't skip this filter. The page content is of the login page.</p> <p>When we run this with <code>rails server</code> it works fine.</p> <p>Any ideas why it behaves this way or what to look for to resolve this?</p> <p><strong>UPDATE:</strong></p> <p>It might be worth adding that this only happens using Linux. Under MacOS 10.7 with the "same" setup it works fine.</p> <p><strong>Controller Code:</strong></p> <pre><code>class Library::CategoriesController &lt; ApplicationController skip_before_filter :authenticate_user!, :only =&gt; [:show] # GET /categories/1 # GET /categories/1.json def show @categories = Category.all @category = Category.find(params[:id]) @articles = @category.articles.where(:locale =&gt; I18n.locale) respond_to do |format| format.html # show.html.erb end end end </code></pre> <p>The application_controller looks like (without the set_i18n_locale_from_url):</p> <pre><code>class ApplicationController &lt; ActionController::Base protect_from_forgery before_filter :set_i18n_locale_from_url, :authenticate_user! end </code></pre> <p><strong>Routes:</strong></p> <pre><code>namespace :library do get '/' =&gt; 'library#index', :as =&gt; 'library' resources :categories, :path =&gt; '', :only =&gt; [:show] resources :categories, :path =&gt; '', :only =&gt; [] do resources :articles, :path =&gt; '', :only =&gt; [:show] end end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload