Sha256: 366fe78c07ca7a7d20636ce003772605d64078672f33493460e8e478983d2ca8

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class TestOptions < Minitest::Test
  API_KEY = 'abcdefg'

  def test_works_with_named_arguments
    assert_equal API_KEY, Prefab::Options.new(api_key: API_KEY).api_key
  end

  def test_works_with_hash
    assert_equal API_KEY, Prefab::Options.new({ api_key: API_KEY }).api_key
  end

  def test_collect_max_paths
    assert_equal 1000, Prefab::Options.new.collect_max_paths
    assert_equal 100, Prefab::Options.new(collect_max_paths: 100).collect_max_paths
  end

  def test_collect_max_paths_with_local_only
    options = Prefab::Options.new(collect_max_paths: 100,
                                  prefab_datasources: Prefab::Options::DATASOURCES::LOCAL_ONLY)
    assert_equal 0, options.collect_max_paths
  end

  def test_collect_max_paths_with_collect_logs_false
    options = Prefab::Options.new(collect_max_paths: 100,
                                  collect_logs: false)
    assert_equal 0, options.collect_max_paths
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prefab-cloud-ruby-0.23.1 test/test_options.rb
prefab-cloud-ruby-0.23.0 test/test_options.rb
prefab-cloud-ruby-0.22.0 test/test_options.rb