Skip to content

Commit 3ed83af

Browse files
committed
✅ Improve #enable test
1 parent 5d6ab6d commit 3ed83af

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

test/net/imap/test_imap_enable.rb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@ def test_enable
1414
) do |server, imap|
1515
cmdq = server.commands
1616

17-
result1 = imap.enable(%w[CONDSTORE x-pig-latin])
18-
result2 = imap.enable(:utf8, "condstore QResync")
19-
result3 = imap.enable(:utf8, "UTF8=ACCEPT", "UTF8=ONLY")
20-
cmd1, cmd2, cmd3 = Array.new(3) { cmdq.pop.raw.strip }
21-
22-
assert_equal "RUBY0001 ENABLE CONDSTORE x-pig-latin", cmd1
23-
assert_equal "RUBY0002 ENABLE UTF8=ACCEPT condstore QResync", cmd2
24-
assert_equal "RUBY0003 ENABLE UTF8=ACCEPT", cmd3
25-
assert_empty cmdq
17+
enabled = imap.enable(%w[CONDSTORE x-pig-latin])
18+
assert_equal "RUBY0001 ENABLE CONDSTORE x-pig-latin", cmdq.pop.raw.strip
19+
assert_equal %w[CONDSTORE], enabled
20+
21+
enabled = imap.enable(:utf8, "condstore QResync")
22+
assert_equal("RUBY0002 ENABLE UTF8=ACCEPT condstore QResync",
23+
cmdq.pop.raw.strip)
24+
assert_equal %w[UTF8=ACCEPT], enabled
2625

27-
assert_equal %w[CONDSTORE], result1
28-
assert_equal %w[UTF8=ACCEPT], result2
29-
assert_equal [], result3
26+
assert_empty cmdq
3027

3128
assert_raise(Net::IMAP::DataFormatError) do
3229
imap.enable "injection\r\ninjected logout"

0 commit comments

Comments
 (0)