Skip to content

Instantly share code, notes, and snippets.

@marshluca
Created January 15, 2015 13:25
Show Gist options
  • Save marshluca/46e4ce915ff3698eb16c to your computer and use it in GitHub Desktop.
Save marshluca/46e4ce915ff3698eb16c to your computer and use it in GitHub Desktop.
RSpec with Anonymous controller
require 'rails_helper'
RSpec.describe V1::BaseController, :type => :controller do
before do
Rails.application.routes.draw do
match "/v1/dummy", to: "v1/base#index", via: :all
end
end
after do
Rails.application.reload_routes!
end
controller do
def index
render json: { success: true }
end
end
it "should succeed" do
get :index
expect(response).to be_success
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment