[RUBY] About RSpec (Rails)

What is RSpec?

A test framework for the Ruby language. A tool that can automatically check bugs according to the test code by writing the test code in RSpec and executing the test code in the terminal.

Introduction method

(1) Introduce the RSpec Gem.

Gemfile


group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
#↓ ↓ Description to be added this time ↓ ↓
  gem 'rspec-rails', '~> 4.0.0' 
end

Terminal


% bundle install

(2) Create an initial file of RSpec.

Terminal


% rails generate rspec:install

The following files are created by executing this command.

Terminal


.rspec
spec
spec/spec_helper.rb
spec/rails_helper.rb

Recommended Posts

About RSpec (Rails)
About Rails 6
[Rails] About Rspec response test
About Rails routing
[Rails] About ActiveJob ,!
Rspec Basics [Rails]
[Rails5] Rspec -validation-
About Rails controller
[Rails] About migration files
[Rails 6] About main gems
[Rails] About active hash
About rails application server
MEMO about Rails 6 series
[Rails] About Slim notation
[Rails] Test with RSpec
Rails, RSpec installation procedure
[rails] About devise defaults
Rails: About partial templates
About rails strong parameters
[Beginner] About Rails Session
about the where method (rails)
[RSpec] Let's use FactoryBot [Rails]
About naming Rails model methods
[Rails] About scss folder structure
[Rails] Test code using Rspec
About =
About Rails scraping method Mechanize
[Rails] About the Punk List function
About the symbol <%%> in Rails erb
Rails book review app RSpec introduction
[Rails] About implementation of like function
[Rails5] Rspec -Unit test when nesting-
[Rails] RSpec Kihon no Ki [Introduction]
About app testing RSpec (unit test)
[Rails] About helper method form_with [Basic]
About RSpec introduction & closely related gems
Consideration about Rails and Clean Architecture
Let's unit test with [rails] Rspec!
About method.invoke
[Rails g.error]
About Kotlin
About attr_accessor
Rails Review 1
About Hinemos
RSpec setup
Rails API
Rails migration
About inheritance
[Rails] first_or_initialize
About params
About Docker
[Ruby on Rails] View test with RSpec
Introducing RSpec
About form_for
About Spring ③
[Ruby on Rails] About bundler (for beginners)
About enum
[Rails 6.0] About batch saving of multiple records
Rails foundation
About polymorphism
About Optional