Sha256: 212a406680185b210550bbc6794d50f0640a23163c4075c9e18534354645c045

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

# Part of the Optimus package for managing E-Prime data
# 
# Copyright (C) 2008-09 Board of Regents of the University of Wisconsin System
# 
# Written by Nathan Vack <njvack@wisc.edu>, at the Waisman Laborotory for Brain
# Imaging and Behavior, University of Wisconsin - Madison

require File.join(File.dirname(__FILE__),'../spec_helper')
require File.join(File.dirname(__FILE__), '../../lib/optimus')
require 'transformers/row_filter'
require 'parsed_calculator'
include OptimusTestHelper

describe Optimus::Transformers::RowFilter do
  before :all do
    @parser = Optimus::ParsedCalculator::ExpressionParser.new
  end
  before :each do
    @edata = mock_edata
  end
  
  it "should allow filtering based on a proc" do
    filter = Optimus::Transformers::RowFilter.new(@edata, lambda { |row| !row['sparse'].to_s.empty? })
    filter.each do |row|
      row['sparse'].to_s.should_not be_empty
    end
  end
  
  it "should filter based on column equal test" do
    exp = @parser.parse("{run_start} = 2400")
    filter = Optimus::Transformers::RowFilter.new(@edata, exp)
    filter.to_a.size.should_not == 0
    filter.each do |row|
      row['run_start'].should == '2400'
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
optimus-ep-0.10.4 spec/transformers/row_filter_spec.rb
optimus-ep-0.10.3 spec/transformers/row_filter_spec.rb
optimus-ep-0.10.2 spec/transformers/row_filter_spec.rb
optimus-ep-0.10.1 spec/transformers/row_filter_spec.rb
optimus-ep-0.10.0 spec/transformers/row_filter_spec.rb
optimus-ep-0.9.1 spec/transformers/row_filter_spec.rb
optimus-ep-0.9.0 spec/transformers/row_filter_spec.rb
optimus-ep-0.8.1 spec/transformers/row_filter_spec.rb
optimus-ep-0.8.0 spec/transformers/row_filter_spec.rb