Sha256: dfe953490d5e90af4dcf9d6d9f0e0ebbd36f5d3049ee7d24f1428179a62c2d79

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

#
# This file is part of the lazier gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
#

require "spec_helper"

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

  before(:all) do
    ::Lazier.load!(:math)
  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

3 entries across 3 versions & 1 rubygems

Version Path
lazier-4.2.9 spec/lazier/math_spec.rb
lazier-4.2.8 spec/lazier/math_spec.rb
lazier-4.2.3 spec/lazier/math_spec.rb