Skip to content

Instantly share code, notes, and snippets.

@sranso
Last active August 29, 2015 13:57
Show Gist options
  • Save sranso/9657707 to your computer and use it in GitHub Desktop.
Save sranso/9657707 to your computer and use it in GitHub Desktop.
require './hash-table'
describe MyHash do
rspec_hash = MyHash.new
describe '#assign_or_find_index' do
it 'should return a number between 0 and 100' do
random_string = (0...8).map { (65 + rand(26)).chr }.join
expect(rspec_hash.assign_or_find_index(random_string)).to be_between(0, 100)
end
end
describe '#insert' do
it 'should insert a key-value pair ' do
expect(rspec_hash.insert("a key", "a value")).to eq([["a key", "a value"]])
end
end
describe '#find' do
it 'should return the right value given a key' do
expect(rspec_hash.find("a key")).to eq("a value")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment