Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/spec/more.rb
Instance Method Summary collapse
-
#enums(other) ⇒ Object
element wise matching using each.
- #is(other) ⇒ Object
- #isa(other) ⇒ Object
- #isnt(other) ⇒ Object
- #matches(other) ⇒ Object
- #ok ⇒ Object
Instance Method Details
#enums(other) ⇒ Object
element wise matching using each
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/spec/more.rb', line 24 def enums(other) self_ar = [] self.each do |v| self_ar << v end other_ar = [] other.each do |v| other_ar << v end self_ar.zip(other_ar) do |a,b| a.should.equal b end end |
#is(other) ⇒ Object
6 7 8 |
# File 'lib/spec/more.rb', line 6 def is(other) should.equal other end |
#isa(other) ⇒ Object
14 15 16 |
# File 'lib/spec/more.rb', line 14 def isa(other) self.class.should.equal other end |
#isnt(other) ⇒ Object
10 11 12 |
# File 'lib/spec/more.rb', line 10 def isnt(other) should.not.equal other end |
#matches(other) ⇒ Object
18 19 20 21 |
# File 'lib/spec/more.rb', line 18 def matches(other) other = Regexp.new(Regexp.escape(other)) if other.is_a?(String) should.match other end |
#ok ⇒ Object
38 39 40 |
# File 'lib/spec/more.rb', line 38 def ok should.equal true end |