Jason Swett
Jason Swett

Reputation: 45074

Where is the source code for get/post/etc functions in Rails controller specs?

This page has a controller spec example that looks like this:

require "spec_helper"

describe WidgetsController do
  describe "GET index" do
    it "has a 200 status code" do
      get :index
      expect(response.code).to eq("200")
    end
  end
end

Where would I find the source code for the get function? I don't even know if that's part of RSpec or Rails.

Upvotes: 0

Views: 190

Answers (1)

Jason Swett
Jason Swett

Reputation: 45074

The code can be found here. Turns out it's part of Rails, not RSpec.

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/test_case.rb#L474

Upvotes: 3

Related Questions