Skip to content

Commit

Permalink
Migrate tests of SquidACL to RSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed May 18, 2020
1 parent 8a43661 commit 84d4d4f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 64 deletions.
39 changes: 39 additions & 0 deletions test/squid_acl_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#! /usr/bin/env rspec

require_relative "./test_helper"

Yast.import "SquidACL"

describe "Yast::SquidACL" do
subject { Yast::SquidACL }

let(:acls) do
[
"arp", "browser", "dst", "dstdom_regex", "dstdomain", "maxconn", "method",
"myip", "myport", "port", "proto", "referer_regex", "rep_header", "rep_mime_type",
"req_header", "req_mime_type", "src", "srcdom_regex", "srcdomain", "time",
"url_regex", "urlpath_regex"
]
end

describe ".SupportedACLs" do
it "returns the full list of ACLs" do
expect(subject.SupportedACLs).to contain_exactly(*acls)
end
end

describe ".GetTypesToComboBox" do
it "returns an array of item terms" do
result = subject.GetTypesToComboBox
expect(result).to be_a Array
expect(result).to all be_a(Yast::Term)
expect(result.map(&:value)).to all eq(:item)
end

it "includes one item per each ACL" do
result = subject.GetTypesToComboBox
values = result.map { |item| item.params[1] }
expect(values).to contain_exactly(*acls)
end
end
end
Empty file removed testsuite/tests/SquidACL.err
Empty file.
4 changes: 0 additions & 4 deletions testsuite/tests/SquidACL.out

This file was deleted.

60 changes: 0 additions & 60 deletions testsuite/tests/SquidACL.rb

This file was deleted.

0 comments on commit 84d4d4f

Please sign in to comment.