Sha256: e8afc949bfa9e2f277aa4078618730f30e371841436594ff133fa7cac5bb139e
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Rbm::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 describe '#and_try Functor' do specify 'returns nil if nil is a receiver' do nil.should respond_to :and_try expect { nil.and_try.size.should be nil }.not_to raise_error end specify 'returns false if false is a receiver' do false.should respond_to :and_try expect { false.and_try.size } end specify 'returns 11 for "test string".and_try.size' do 'test string'.and_try.size.should be 11 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubymisc-0.2.0 | spec/rubymisc/ext/object_spec.rb |
rubymisc-0.1.0 | spec/rubymisc/ext/object_spec.rb |
rubymisc-0.0.4 | spec/rubymisc/ext/object_spec.rb |