Created
June 16, 2022 20:31
-
-
Save rzane/c3753b4ab34b58948a410634f03f1493 to your computer and use it in GitHub Desktop.
Writing a controller spec outside of a Rails application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'rails' | |
require 'action_view' | |
require 'action_controller' | |
require 'rspec/rails' | |
class TestApplication < Rails::Application | |
end | |
RSpec.describe 'example', type: :controller do | |
controller do | |
def index | |
head :ok | |
end | |
end | |
it 'works' do | |
get :index | |
expect(response).to have_http_status(:ok) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment