1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-04-14

参考: 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)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?