Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8834ab938e
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 24 lines (22 sloc) 0.654 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
require 'set'
require 'test/unit'
require 'context'
require 'matchy'
require 'lib/every'

class EveryTest < Test::Unit::TestCase
  context "Every" do
    test "is a basic object" do
      whitelist = %w( __id__ __send__ method_missing )
      Enumerable::Proxy.instance_methods.to_set.should be(whitelist.to_set)
    end
    test "passes message onto enumerable's items" do
      [1.4, 2.4, 3.4].every.floor.should be([1,2,3])
    end
    test "allows arguments" do
      %w( axb dxf ).every.gsub(/x/,'y').should be(%w( ayb dyf ))
    end
    test "allows blocks" do
      %w( axb dxf ).every.gsub(/x/) { 'y' }.should be(%w( ayb dyf ))
    end
  end
end
Something went wrong with that request. Please try again.