Fixed broken rspec and added coverage for index function