Skip to content

Commit 5f94dcc

Browse files
committed
Add support for newer versions of mocha
* Update test assertions to modern Mocha methods * Change require 'mocha/setup' to require 'mocha/test_unit' in test_helper.rb
1 parent e07d7f2 commit 5f94dcc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/ad_provider_test.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_rebuild_host_returns_password
7474
end
7575

7676
def test_generate_password_returns_random_passwords
77-
assert_not_equal @provider.generate_password, @provider.generate_password
77+
refute_equal @provider.generate_password, @provider.generate_password
7878
end
7979

8080
def test_generate_password_returns_20_char_long_password
@@ -83,22 +83,22 @@ def test_generate_password_returns_20_char_long_password
8383

8484
def test_apply_computername_prefix_should_return_false_when_prefix_is_nil
8585
provider = Proxy::AdRealm::Provider.new(computername_prefix: nil, realm: 'example.com')
86-
assert_false provider.apply_computername_prefix?('host.example.com')
86+
refute provider.apply_computername_prefix?('host.example.com')
8787
end
8888

8989
def test_apply_computername_prefix_should_return_false_when_prefix_is_empty
9090
provider = Proxy::AdRealm::Provider.new(computername_prefix: '', realm: 'example.com')
91-
assert_false provider.apply_computername_prefix?('host.example.com')
91+
refute provider.apply_computername_prefix?('host.example.com')
9292
end
9393

9494
def test_apply_computername_prefix_should_return_false_when_hostname_contains_prefix
9595
provider = Proxy::AdRealm::Provider.new(computername_prefix: 'PREFIX-', realm: 'example.com')
96-
assert_false provider.apply_computername_prefix?('prefix-host.example.com')
96+
refute provider.apply_computername_prefix?('prefix-host.example.com')
9797
end
9898

9999
def test_apply_computername_prefix_should_return_true_when_computername_hash_is_used
100100
provider = Proxy::AdRealm::Provider.new(computername_prefix: 'PREFIX-', computername_hash: true, realm: 'example.com')
101-
assert_true provider.apply_computername_prefix?('host.example.com')
101+
assert provider.apply_computername_prefix?('host.example.com')
102102
end
103103

104104
def test_hostfqdn_to_computername_uses_prefix
@@ -121,7 +121,7 @@ def test_unrecognized_realm_raises_exception
121121
end
122122

123123
def test_find
124-
assert_true @provider.find('a_host_fqdn')
124+
assert @provider.find('a_host_fqdn')
125125
end
126126

127127
def test_delete

test/test_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'test/unit'
4-
require 'mocha/setup'
4+
require 'mocha/test_unit'
55

66
require 'smart_proxy_for_testing'
77

0 commit comments

Comments
 (0)