0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Rspecとは

Last updated at Posted at 2024-12-05

一緒に仕事ができてCucumber,Minitestと独立してテストを行う Rspec

RSpec is composed of multiple libraries, which are designed to work together, or can be used independently with other testing tools like Cucumber or Minitest.

Rspecを構成するライブラリ

rspec-core

rspec-core: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples.

rspec-core provides the structure for writing executable examples of how your code should behave, and an rspec command with tools to constrain which examples get run and tailor the output.

rspec-expectations

rspec-expectations: Provides a readable API to express expected outcomes of a code example.

RSpec::Expectations lets you express expected outcomes on an object in an example.

rspec-mocks

rspec-mocks: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.

rspec-mocks is a test-double framework for rspec with support for method stubs, fakes, and message expectations on generated test-doubles and real objects alike.

rspec-rails

rspec-rails: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.

rspec-rails brings the RSpec testing framework to Ruby on Rails as a drop-in alternative to its default testing framework, Minitest.

感想

  • rspec-coreは、あなたのコードがどのように動作すべきかを示す実行可能なサンプルを書くための構造と、どのサンプルが実行されるかを制限し、出力を調整するためのツールを備えたrspecコマンドを提供します
  • RSpec::Expectationsを使用すると、サンプル内のオブジェクトに期待される結果を表現できます
  • rspec-mocksはrspec用のテストダブルフレームワークで、生成されたテストダ ブルと実際のオブジェクトに対して、メソッドスタブ、フェイク、メッセージの期待値 をサポートします
  • rspec-railsは、Ruby on RailsのデフォルトのテストフレームワークであるMinitestのドロップインの代替として、RSpecテストフレームワークをRuby on Railsにもたらします

翻訳を読んでも理解できなかったので手を動かして理解する

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?