What is the most accurate test type for testing a normal ruby class (PORO) with rspec – in my case a service. Normally I would have used a :model
test.
But just for the sake of idiomatic testing: Is there a way of having an rspec test which is thinner than the :model
type?
RSpec is a Behavior-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.
RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.
RSpec is a unit test framework for the Ruby programming language. RSpec is different than traditional xUnit frameworks like JUnit because RSpec is a Behavior driven development tool. What this means is that, tests written in RSpec focus on the "behavior" of an application being tested.
There is no type to apply. Just treat it as a PORO and write a spec for it. If you really wanted to add a type, you could add type: :service
but it won't do anything by default.
RSpec.describe MyServiceObject do
# specs
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With