Sha256: b53788d8f912209c4a2eca10e7771e0a3f8db40c35cf9180c192735b283b519b

Contents?: true

Size: 1.02 KB

Versions: 23

Compression:

Stored size: 1.02 KB

Contents

require_relative 'helper'

class FeatureTest < Minitest::Test

  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

23 entries across 23 versions & 1 rubygems

Version Path
mxhero-api-1.2.9 test/test_feature.rb
mxhero-api-1.2.8 test/test_feature.rb
mxhero-api-1.2.7 test/test_feature.rb
mxhero-api-1.2.6 test/test_feature.rb
mxhero-api-1.2.5 test/test_feature.rb
mxhero-api-1.2.4 test/test_feature.rb
mxhero-api-1.2.3 test/test_feature.rb
mxhero-api-1.2.2 test/test_feature.rb
mxhero-api-1.2.1 test/test_feature.rb
mxhero-api-1.2.0 test/test_feature.rb
mxhero-api-1.1.4 test/test_feature.rb
mxhero-api-1.1.3 test/test_feature.rb
mxhero-api-1.1.2 test/test_feature.rb
mxhero-api-1.1.1 test/test_feature.rb
mxhero-api-1.1.0 test/test_feature.rb
mxhero-api-1.0.5 test/test_feature.rb
mxhero-api-1.0.4 test/test_feature.rb
mxhero-api-1.0.3 test/test_feature.rb
mxhero-api-1.0.2 test/test_feature.rb
mxhero-api-1.0.1 test/test_feature.rb