Given 'hash includes indexer' do class Hash include Strabo::Indexer end end Given /a hash with/ do |table| @context = {} table.rows_hash.each do |keys, values| @context[keys] = values end end Then /it should have the following term frequencies:/ do |table| begin table.map_headers!('T' => 'term', 'F' => 'frequency') rescue # no big deal end table.hashes.each do |row| @context.keywords(true)[row['term']].should eql(row['frequency'].to_i) end end Then /it should have the following "(.+)" term frequencies:/ do |attribute, table| begin table.map_headers!('T' => 'term', 'F' => 'frequency') rescue # no big deal end table.hashes.each do |row| @context.keywords[attribute].keys.should include(row['term']) @context.keywords[attribute][row['term']].should eql(row['frequency'].to_i) end end