Skip to content

Instantly share code, notes, and snippets.

@bolshakov
Last active April 19, 2019 13:53
Show Gist options
  • Save bolshakov/48cba192aaf7458606f30035e774bfb3 to your computer and use it in GitHub Desktop.
Save bolshakov/48cba192aaf7458606f30035e774bfb3 to your computer and use it in GitHub Desktop.
RSpec.shared_examples Enumerator do |enum|
describe '#each', 'without block' do
subject { enum.each }
it 'returns Enumeretator' do
is_expected.to be_kind_of(Enumerator)
end
end
end
it_behaves_like Enumerator, [1, 2, 3]
it_behaves_like Enumerator, {h: 1, b: 2} do
it { is_expected.to respond_to(:has_key?) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment