Sha256: 93fccb774fd0ae214fb484ebd1d7ca967cafea80a31c5d353d8bbc8d6e89cadd

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 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

4 entries across 4 versions & 1 rubygems

Version Path
dentaku-3.3.0 spec/ast/min_spec.rb
dentaku-3.2.1 spec/ast/min_spec.rb
dentaku-3.2.0 spec/ast/min_spec.rb
dentaku-3.1.0 spec/ast/min_spec.rb