Sha256: b8d1ea17a6d407a1f2b29d0f0924a9fead1942c5e9a1a24fdb1cb8e6b83a1214

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# encoding: utf-8
#
# This file is part of the lazier gem. Copyright (C) 2012 and above Shogun <shogun_panda@me.com>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"

describe Lazier::Math do
  let(:first) { 1 }
  let(:second) { 2 }
  let(:third) { 0 }

  before(:all) do
    ::Lazier.load!
  end

  describe "::min" do
    it "should return the minimum argument" do
      expect(::Math.min(first)).to eq(first)
      expect(::Math.min(first, second)).to eq(first)
      expect(::Math.min([first, [second, third]])).to eq(third)
    end

    it "should return nil for an empty array" do
      expect(::Math.min()).to be_nil
    end
  end

  describe "::max" do
    it "should return the maximum argument" do
      expect(::Math.max(first)).to eq(first)
      expect(::Math.max(first, second)).to eq(second)
      expect(::Math.max([first, [second, third]])).to eq(second)
    end

    it "should return nil for an empty array" do
      expect(::Math.max()).to be_nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lazier-1.0.6 spec/lazier/math_spec.rb
lazier-1.0.5 spec/lazier/math_spec.rb
lazier-1.0.4 spec/lazier/math_spec.rb
lazier-1.0.3 spec/cowtech-extensions/math_spec.rb
lazier-1.0.2 spec/cowtech-extensions/math_spec.rb
lazier-1.0.1 spec/cowtech-extensions/math_spec.rb