Sha256: 5a7dfe4d47b5e1673a09da750de3fe259a2f418368a6d2c7626061d5af1b47cf

Contents?: true

Size: 1.04 KB

Versions: 31

Compression:

Stored size: 1.04 KB

Contents

# encoding: utf-8
#
# This file is part of the lazier gem. Copyright (C) 2013 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

31 entries across 31 versions & 1 rubygems

Version Path
lazier-3.2.5 spec/lazier/math_spec.rb
lazier-3.2.4 spec/lazier/math_spec.rb
lazier-3.2.3 spec/lazier/math_spec.rb
lazier-3.2.2 spec/lazier/math_spec.rb
lazier-3.2.1 spec/lazier/math_spec.rb
lazier-3.2.0 spec/lazier/math_spec.rb
lazier-3.1.0 spec/lazier/math_spec.rb
lazier-3.0.1 spec/lazier/math_spec.rb
lazier-3.0.0 spec/lazier/math_spec.rb
lazier-2.8.1 spec/lazier/math_spec.rb
lazier-2.8.0 spec/lazier/math_spec.rb
lazier-2.7.0 spec/lazier/math_spec.rb
lazier-2.6.7 spec/lazier/math_spec.rb
lazier-2.6.6 spec/lazier/math_spec.rb
lazier-2.6.5 spec/lazier/math_spec.rb
lazier-2.6.4 spec/lazier/math_spec.rb
lazier-2.6.3 spec/lazier/math_spec.rb
lazier-2.6.2 spec/lazier/math_spec.rb
lazier-2.6.1 spec/lazier/math_spec.rb
lazier-2.5.3 spec/lazier/math_spec.rb