We have a strange problem. In the application controller, we have a set before_filterthat requires authentication with deviseand redirects, if necessary, the login page.
In our library controller, we will skip this one before_filter.
skip_before_filter :authenticate_user!, :only => :show
When we run a simple functional test with capybaraand rspec, the test fails.
it "should get only english articles within the category 'computers'" do
visit '/en/library/computers'
page.should have_content('computers')
end
It does not seem to miss this filter. The content of the page is on the login page.
When we run this with help rails server, it works great.
Any ideas why he is behaving this way or what to look for to solve this problem?
UPDATE:
It might be worth adding that this only happens on Linux. On macOS 10.7 with the “same” setting, it works fine.
Controller Code:
class Library::CategoriesController < ApplicationController
skip_before_filter :authenticate_user!, :only => [:show]
def show
@categories = Category.all
@category = Category.find(params[:id])
@articles = @category.articles.where(:locale => I18n.locale)
respond_to do |format|
format.html
end
end
end
Application_controller ( set_i18n_locale_from_url):
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_i18n_locale_from_url, :authenticate_user!
end
namespace :library do
get '/' => 'library#index', :as => 'library'
resources :categories, :path => '', :only => [:show]
resources :categories, :path => '', :only => [] do
resources :articles, :path => '', :only => [:show]
end
end