Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What do you mean by spec in rspec?


Asked by Royal Ashley on Dec 11, 2021 FAQ



RSpec uses the term “spec” which is a short form for “specification”. Since, RSpec is a BDD test tool, the goal is to focus on what the application does and whether or not it follows a specification. In behavior driven development, the specification is often described in terms of a “User Story”.
And,
RSpec files are known as “specs”. If this seems confusing to you, you can think of a spec file as a test file. RSpec uses the term “spec” which is a short form for “specification”. Since, RSpec is a BDD test tool, the goal is to focus on what the application does and whether or not it follows a specification.
In addition, ` RSpec.describe ` is just technically ensuring it’s scoped by RSpec, followed by a class name ‘User’ which allows it to implicitly set the subject for RSpec. The type allows RSpec to recognize what type of test this is. The ‘pending’ as the name implies it is a pending example allowing you to test run your specs.
Also,
Since, RSpec is a BDD test tool, the goal is to focus on what the application does and whether or not it follows a specification. In behavior driven development, the specification is often described in terms of a “User Story”.
In fact,
This is the initial code for writing your first RSpec test. You need to require the rspec gem. Then you need to create a describe block to group all your tests together & to tell RSpec which class you are testing. Next is the it block: