overdrivemachines / factory_bot_test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Testing Active Storage and Devise using Factory Bot and RSpec

Model

Generated by Rails ERD. Run rails erd to regenerate (must have graphviz). ERD Diagram

Versions

  • ruby 3.2.2
  • Rails 7.0.8

Notes

  • Sample Image: spec/assets/images/test.jpg
  • attach the image in factories/post.rb
  • Include in view specs if you want to use rails_blob_path: include Rails.application.routes.url_helpers
  • Test if image is rendering using: assert_select "img[src=?]", rails_blob_path(@post.image, only_path: true), count: 1
  • In spec/rails_helper.rb, add: config.include Devise::Test::ControllerHelpers, type: :view

References

About


Languages

Language:Ruby 86.3%Language:HTML 10.8%Language:JavaScript 1.8%Language:CSS 1.0%