Skip to content

Instantly share code, notes, and snippets.

@nelsonsar
Created October 28, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelsonsar/cadb79d1a3d96168473cb942488c0439 to your computer and use it in GitHub Desktop.
Save nelsonsar/cadb79d1a3d96168473cb942488c0439 to your computer and use it in GitHub Desktop.
Exemplo de mock
require 'spec_helper'
describe Employee do
describe '#salary' do
it 'return amount based on employee region' do
region = double
expect(region).to receive(:salary_by)
.with('Nelson').and_return(5000)
employee = Employee.new('Nelson', region)
expect(employee.salary).to eq(5000)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment