Sha256: fad4cf13fb40582ce34abdca1b187897a4c5f226afcbf8a52a8debf973075bed

Contents?: true

Size: 589 Bytes

Versions: 6

Compression:

Stored size: 589 Bytes

Contents

require 'spec_helper'
require 'dentaku/ast/functions/min'
require 'dentaku'

describe 'Dentaku::AST::Function::Min' do
  it 'returns the smallest numeric value in an array of Numeric values' do
    result = Dentaku('MIN(1, x, 1.8)', x: 2.3)
    expect(result).to eq(1)
  end

  it 'returns the smallest value even if a String is passed' do
    result = Dentaku('MIN(1, x, 1.8)', x: '0.3')
    expect(result).to eq(0.3)
  end

  it 'returns the smallest value even if an Array is passed' do
    result = Dentaku('MIN(1, x, 1.8)', x: [1.5, 0.3, 1.7])
    expect(result).to eq(0.3)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dentaku-3.4.1 spec/ast/min_spec.rb
dentaku-3.4.0 spec/ast/min_spec.rb
dentaku-3.3.4 spec/ast/min_spec.rb
dentaku-3.3.3 spec/ast/min_spec.rb
dentaku-3.3.2 spec/ast/min_spec.rb
dentaku-3.3.1 spec/ast/min_spec.rb