Sha256: f43722be128bc868764ee7277b1293b02ef1b5b6bf3d8b6dba683e53333e3264

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubymisc::Object do
  let(:collection) { [1, 2, 3, 4, 5, 100] }

  describe '#in?' do
    context 'given collection includes element' do
      specify 'returns true' do
        100.in?(collection).should be_true
      end
    end

    context 'given collection does not include element' do
      specify 'returns false' do
        101.in?(collection).should be_false
      end
    end
  end

  describe '#not Functor' do
    specify 'String#empty? returns false for blank string with #not Functor' do
      ''.empty?.should be true
      ''.not.empty?.should be false
    end

    specify 'Object#instance_of? returns false when class matches with #not Functor' do
      100.instance_of?(Fixnum).should be true
      100.not.instance_of?(Fixnum).should be false
    end

    specify 'Enumerable#include? returns false for collection having an element with #not Functor' do
      collection.include?(1).should be true
      collection.not.include?(1).should be false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubymisc-0.0.3.3 spec/rubymisc/ext/object_spec.rb
rubymisc-0.0.3.2 spec/rubymisc/ext/object_spec.rb
rubymisc-0.0.3.1 spec/rubymisc/ext/object_spec.rb
rubymisc-0.0.3 spec/rubymisc/ext/object_spec.rb
rubymisc-0.0.2 spec/rubymisc/ext/object_spec.rb
rubymisc-0.0.1 spec/rubymisc/ext/object_spec.rb