Skip to content

Instantly share code, notes, and snippets.

@caalberts
Created October 25, 2017 02:38
Show Gist options
  • Save caalberts/711e19f5afb6950bb39b5b47e55c861f to your computer and use it in GitHub Desktop.
Save caalberts/711e19f5afb6950bb39b5b47e55c861f to your computer and use it in GitHub Desktop.
describe 'service object' do
let(:data) { { a: 1, b: 2 } }
let(:dependency) { double() }
before do
allow(dependency).to receive(:call).and_return(data)
end
it 'wraps data from dependency into a hash' do
result = Service.new(dependency).exec()
expect(result[:success]).to be(true)
expect(result[:data]).to eql(data)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment