How to filter stacktrace in byebug

Category: Ruby :: Published at: 12.10.2021

Sometimes simple debugging with byebug is not enough and you need to dive deeper.

If you need to get the stacktrace you can simply use command:

Read more

RSpec - How to chain .to change matcher in rubocop

Category: Ruby :: Published at: 23.09.2021

If you use rubocop and want to chain [.to change] matcher, it can be quite confusing.

Here is how you should do it correctly:

subject(:service_call) { id) }

let(:car) { create :car }

it "passes test" do
  expect { service_call }.to(
    change { car.brand }.to("Opel")
      .and(change { car.model }.to("Astra")
      .and(change { car.production_year }.to(1997),

How to connect NGROK with a Rails application

Category: Ruby :: Published at: 01.07.2021

Ngrok let us to publish our local application for the world. It is very useful for example if we want to create a webhook integration.

These are simple steps to connect NGROK with your rails application:

Read more

Rspec not_to change .and not_to change - how to do it?

Category: Ruby :: Published at: 29.06.2021

We can't chain not_to change .and not_to change in one rspec matcher call.

But the gem creators made for us some simple and very useful workaround:

Read more

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) { }

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
       Can't connect with a custom car database.

Why it didn't pass the spec?

The problem is here:

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