Intro To Rspec Mocks
RSpec provides tools that help you test the behavior of your Ruby objects. Join Abiodun Olowode for a tour of mocks, stubs, and spies—and learn how to use them in your Ruby projects!
RSpec provides tools that help you test the behavior of your Ruby objects. Join Abiodun Olowode for a tour of mocks, stubs, and spies—and learn how to use them in your Ruby projects!
A state machine can hold all possible states of something and the allowed transitions between these states. For example, the state machine for a door would have only two states (open and closed) and only two transitions (opening and closing). On the other hand, complex state machines can have several different states with hundreds of transitions between them.
In the Ruby programming language, exceptions are a common feature. About 30 different exception subclasses are defined in the Ruby standard library, some of which have their subclasses. Ruby's exception mechanism is quite strong, yet it is frequently misused. This article will go over how to use rescue exceptions in ruby and how to handle them.
What if you could write sloppy code and have Ruby fix it for you automatically? With RuboCop, you can! Of course, linters and auto-formatters have other benefits, even if your code is pristine. Join Ayooluwa Isaiah for a tour of RuboCop.
Ask any software engineer to review key portions of production code, and inevitably, they will point out three things that need to be refactored. So why does so much bad, brittle, or misunderstood code remain running in production? The answer is simple: engineers are afraid to touch it. Refactoring tasks get identified and added to the backlog, but rarely make it into the current sprint. There are numerous reasons for this.
If you define the same method on a class, a subclass, and a mixin, which one gets called first? Join Abiodun Olowode in an exploration of Ruby's object model!
Race conditions are hard to debug—especially when you don't know it's a race condition! This article looks at some common race conditions and the best solutions for handling each one.
Data integrity problems are among the most common database issues Rails developers face. Besides allowing for proper validation, correctly designed transaction blocks ensure that your data isn't partially created or updated. However, transactions can also harm your application — or even take down your whole database — when not properly designed. This article offers a set of good practices for working with transactions.
Most applications need background jobs for mailers, regular clean-ups, or any other time-consuming operation that doesn't require a user to be present. Several gems support job queues and background processing in the Rails world — Delayed Job and Sidekiq being the two most popular ones. In this post, we will take a detailed look at Delayed Job and Sidekiq, including how they fare against each other. Let's go!
AWS Lambda lets you run your code without worrying about the nuts and bolts of server management or scaling. You might even say it's "serverless." In this article, Jeffrey Morhous shows us how to get started writing Lambda functions in Ruby.