Sha256: dd5f73c19934c587227162c715d0e7122aa36e945798161df744d45a6eb313e2

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

require File.expand_path('spec/spec_helper')

describe Pru do
  before :all do
    @default = `ls -l | wc -l`
  end

  it "has a VERSION" do
    Pru::VERSION.should =~ /^\d+\.\d+\.\d+$/
  end

  it "maps" do
    `ls -l | ./bin/pru 'include?("G")'`.split("\n").size.should == 2
  end

  it "maps and reduces" do
    `ls -l | ./bin/pru 'include?("G")' 'size'`.should == "2\n"
  end

  it "maps with empty string and reduces" do
    `ls -l | ./bin/pru '' 'size'`.should == @default
  end

  it "reduces" do
    `ls -l | ./bin/pru -r 'size'`.should == @default
  end

  it "can sum" do
    `echo 5 | ./bin/pru -r 'sum(&:to_i)'`.should == "5\n"
  end

  it "can mean" do
    `echo 5 | ./bin/pru -r 'mean(&:to_i)'`.should == "5.0\n"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pru-0.1.0 spec/pru_spec.rb