How to skip middleware in Rspec query specs?

I am writing some pretty standard Rspec request specifications for a Rails application.

describe "show" do
  it "should respond successfully when given an id that exists" do
    @badger = FactoryGirl.create(:badger)
    get "/badgers/#{@badger.id}"
    response.should be_ok
  end
end

      

However, we just added a single sign-on middleware component, so the response is returned as a "please sign in" redirect.

For the purposes of these tests, how can I leave the middleware offline? (He has his own tests elsewhere.)

+3


source to share


1 answer


In yours, config/environments/test.rb

you can uninstall this middleware:



config.middleware.delete YourMiddleware::Goes::Here

      

+5


source







All Articles