I'm working on a MVP (minimum viable product). In order to offer a simpler way to secure the admin pages, I just did add http_basic_authenticate_with to my AdminController.
Problem is that when I want to test my AdminController, I get "unauthorized" (401) for not being logged in.
In this scenario, it's irrelevant to test the authentication - it's just temporary, and as soon I go to the next sprint, it's going to removed -, so I'm trying to skip it within RSpec.
Problem is I tried many ways, and none seems to be working.
For example, I tried to modify the http_basic_authenticate_with in order to avoid the authentication. Like this:
require 'spec_helper'
module ActionController
module HttpAuthentication
module Basic
def http_basic_authenticate_with(*args)
end
end
end
end
describe Admin::SubscribersController do
describe "GET 'index'" do
it "should be OK" do
get 'index'
response.should be_successful
end
end
end
But when I run it, it still returns "false" for that simple test.
Btw, in order to simplify this test, I just have an empty index action on my AdminController and an empty view (index.html.erb).