Edited at

rspec で header 指定できないときに確認すること

More than 1 year has passed since last update.

参考: https://github.com/rspec/rspec-rails/issues/1655

header を含むテストは spec/controllers/ ではなく spec/requests/ (type: :request) で書く。

require 'rails_helper'

RSpec.describe "Tags", type: :request do
it "returns a success response" do
get "/tags/#{@tag.id}", headers: headers
end
end

rspec-rails (3.7.1)