test/test_mxhero_api.rb in mxhero-api-0.1.9 vs test/test_mxhero_api.rb in mxhero-api-0.1.10

- old
+ new

@@ -8,10 +8,18 @@ def domain TEST_API_DOMAIN end + def test_verbose + api = MxHero::API::Client.new + assert ! api.verbose?, 'Verbose is false by default' + + api.verbose = true + assert api.verbose?, 'Verbose state must be changed' + end + def test_update_rule VCR.use_cassette('update_rule') do rules = obtain_rules(domain) existing_rule = rules.first updated_rule = existing_rule.clone @@ -42,9 +50,19 @@ VCR.use_cassette('rules_for_domain') do response = @api.rules_for_domain(domain) assert response.code == 200 rules = response.msg assert_equal domain, rules.first[:domain] + end + end + + def test_rules_for_domain_filter_component + VCR.use_cassette('rules_for_domain_by_component') do + component = 'org.mxhero.feature.signature' + response = @api.rules_for_domain(domain, component) + assert response.code == 200 + rules = response.msg + assert rules.all? { |rule| rule[:component] == component }, "All the rules must be of component type #{component}" end end def test_domains VCR.use_cassette('domains') do