File: pos_spec.rb

package info (click to toggle)
ruby-powerpack 0.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 492 kB
  • sloc: ruby: 819; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 570 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'spec_helper'

unless Numeric.method_defined? :pos?
  describe 'Numeric#pos?' do
    it 'returns true for positive integer' do
      expect(1.pos?).to be_truthy
    end

    it 'returns true for positive float' do
      expect(0.1.pos?).to be_truthy
    end

    it 'returns false for negative integer' do
      expect(-1.pos?).to be_falsey
    end

    it 'returns false for negative float' do
      expect(-0.01.pos?).to be_falsey
    end

    it 'returns false for 0' do
      expect(0.pos?).to be_falsey
      expect(0.0.pos?).to be_falsey
    end
  end
end