|
|
# Stub Example
|
|
|
# Stubs examples
|
|
|
|
|
|
Bellow you will find an example of stub created using Minitest's stub framework. In this example we are using a stub to simulate the behaviour of the *sku_list* method. The original implementation of this method connects to a remote database and returns a huge list (1000+ items) of skus available in the store. For the purpose of this particular test case we do not intend to test the connection with the remote database. We also do not need a huge list of skus, only a few will do. By stubbing this method, we will avoid issues with the remote database and the test will run much faster.
|
|
|
|
|
|
```ruby
|
|
|
test "should list skus not generated" do
|
... | ... | |