Skip to content

Instantly share code, notes, and snippets.

@AlexVPopov
Created September 4, 2017 07:52
Show Gist options
  • Save AlexVPopov/40dfddcf09cbe74a8dbbc4e1133603d4 to your computer and use it in GitHub Desktop.
Save AlexVPopov/40dfddcf09cbe74a8dbbc4e1133603d4 to your computer and use it in GitHub Desktop.
RSpec.describe Person do
let(:person) { described_class.new('Fixed', 'Name', education_level, educator) }
describe '#educate' do
let(:education_level) { 2 }
let(:educator) { instance_double('PersonEducator') }
let(:updated_education_level) { education_level + 1 }
subject { person.education_level }
before do
expect(educator).to receive(:educate).and_return(updated_education_level)
person.educate
end
it { is_expected.to eq updated_education_level }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment