How to test raise_error matcher if it gets an error

Category: Ruby :: Published at: 23.06.2021

The problem with raise_error matcher in RSpec is common and it can be fixed in easy way.

Let's say we have situation like below:

subject(:service_call) { CarService.call }

it { expect(service_call).to raise_error(CarDatabaseConnectionError) }

If we call it like this it will get us an error.

  1) CarUpdateService when fail 
     Failure/Error: raise CarDatabaseConnectionError
     
     CarDatabaseConnectionError:
       Can't connect with a custom car database.

Why it didn't pass the spec?

The problem is here:

Read more

Just focus on the present

Category: Better programmer :: Published at: 03.06.2021

The last chapter in the Essentialism book (by Greg McKeown) is about focusing.

It is interesting not only if you think about being programmer, but in every field of our life in general.

Read more

Applying autocomplete with Rails and Semantic UI

Category: Ruby :: Published at: 28.05.2021

Creating autocomplete with Rails and Semantic UI is very easy, and you should not have problem with that. 
Semantic UI includes search library and all you need to do is just to write couple lines of code.

Read more

Things worth to remember after reading Essentialism book by Greg McKeown

Category: Better programmer :: Published at: 25.05.2021

I've recently read this book and have changed my mind about the way i should follow in my life.
It is not worth to be super productive and give 100% of my life to take every chance i will have on my way.

Read more

How to write shared_examples in RSpec

Category: Ruby :: Published at: 18.05.2021

We are using shared examples if we have the same assertions inside one file.

This is how we can do it:

Read more

How to check speed of your requests in rails console

Category: Ruby :: Published at: 17.05.2021

If you want to check how fast is your request, and which version of your request will be more optimized, you should use Benchmark tool.

Read more