Testing SQL queries in a Ruby service
20-Dec-2024 9
Recently, I worked on a project where we needed to build a Ruby service that would run queries on a third party database and send the results to our main Rails application. The third party database was a huge MSSQL database with tons of data, but we were only using a handful of tables. As I started building the service, I wrote specs for the Ruby code, but mocked all the database calls to return predefined data. This gave me confidence that my Ruby code worked, but the core purpose of the service was querying the database, and that was entirely untested.
.
Testing SQL queries in a Ruby service #ruby #rubydeveloper #rubyonrails #Testing #queries #service #service #sql #testing https://rubyonrails.ba/link/testing-sql-queries-in-a-ruby-service