Skip to content

Instantly share code, notes, and snippets.

View billyyarosh's full-sized avatar

Billy Yarosh billyyarosh

View GitHub Profile
@billyyarosh
billyyarosh / song_service_spec.rb
Last active December 9, 2021 04:45
Song Service Spec with Double
RSpec.describe SongService do
require 'spec_helper'
subject { SongService.new(gateway_service: gateway_service) }
let(:song) { Song.new(name: 'Seek Up', artist: 'Dave Matthews Band', genre: 'Rock') }
context 'using doubles' do
let(:gateway_service) do
stub = double("gateway_service")
@billyyarosh
billyyarosh / song_service_spec.rb
Last active December 9, 2021 15:59
Song Service Spec w/ Spies
RSpec.describe SongService do
require 'spec_helper'
subject { SongService.new(gateway_service: gateway_service) }
let(:song) { Song.new(name: 'Seek Up', artist: 'Dave Matthews Band', genre: 'Rock') }
context 'using spies' do
let(:gateway_service) do
spy = spy("gateway_service")
@billyyarosh
billyyarosh / di.rb
Last active December 9, 2021 05:17
DI Example
def initialize(gateway_service: SongGatewayService.new)
@gateway_service = gateway_service
end