Sha256: e1e04b9745903edb74531021be75d229fcaa92bcfd3eba945c01e322b1a56459

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

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

Then /it should have the following term set:/ do |table|
  table.rows.each do |row|
    @context.keywords(:as => :set).should include(row.first)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strabo-0.0.2 features/steps/index_steps.rb