Rspec

RSpecでログイン状態にする方法

やりたいこと rspecでログイン状態のヘッダー内容をテストしたい RSpec.describe '共通系', type: :system do let(:user) { create(:user) } describe 'ヘッダーの表示' do context 'ログイン前' do before { visit root_path } describe 'ヘッダー' do it '…

Rspec =と<<の使い方

articleに対して、authorとtagが関連付けられています。 article.rb class Article < ApplicationRecord belongs_to :author has_many :tags, through: :article_tags has_many :article_tags . . author.rb class Author < Taxonomy has_many :articles end…

transient

describe '検索機能' do let(:article_with_author) { create(:article, :with_author, author_name: '伊藤') } let(:article_with_another_author) { create(:article, :with_author, author_name: '鈴木') } it '著者名で絞り込み検索ができること' do art…