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 moreIf 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) { my_service.call(car_id: 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),
)
end
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 moreThe 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 moreThe 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