Sha256: 1f305ab6e864e55f1d025a1aa58a38893754550ee7ae6e8db51772e8d1e63de6

Contents?: true

Size: 1.03 KB

Versions: 13

Compression:

Stored size: 1.03 KB

Contents

require_relative 'helper'

class FeatureTest < MiniTest::Unit::TestCase

  def test_build_feature_domain
    feature = MxHero::API::Feature.new data
    assert_equal data[:feature], feature.component
    assert_nil feature.updated
    assert_equal data[:maxRulesAmount], feature.max_rules_amount
    assert ! feature.unlimited_use?
    assert feature.metadata.is_a? Hash
    assert_equal feature.metadata[:appId], 719005621603
  end

  def test_unlimited_use
    feature = MxHero::API::Feature.new data
    assert feature.max_rules_amount > 0
    assert ! feature.unlimited_use?

    unlimited_use = data.dup
    unlimited_use[:maxRulesAmount] = 0
    feature = MxHero::API::Feature.new unlimited_use
    assert_equal Float::INFINITY, feature.max_rules_amount
    assert feature.unlimited_use?

    unlimited_use[:maxRulesAmount] = nil
    feature = MxHero::API::Feature.new unlimited_use
    assert_equal Float::INFINITY, feature.max_rules_amount
    assert feature.unlimited_use?
  end

  def data
    Fixtures::Domain.data[:features].first
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mxhero-api-0.1.55 test/test_feature.rb
mxhero-api-0.1.54 test/test_feature.rb
mxhero-api-0.1.53 test/test_feature.rb
mxhero-api-0.1.52 test/test_feature.rb
mxhero-api-0.1.41 test/test_feature.rb
mxhero-api-0.1.40 test/test_feature.rb
mxhero-api-0.1.39 test/test_feature.rb
mxhero-api-0.1.38 test/test_feature.rb
mxhero-api-0.1.37 test/test_feature.rb
mxhero-api-0.1.36 test/test_feature.rb
mxhero-api-0.1.35 test/test_feature.rb
mxhero-api-0.1.34 test/test_feature.rb
mxhero-api-0.1.33 test/test_feature.rb