linux_admin 1.2.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/linux_admin.rb +0 -8
  3. data/lib/linux_admin/disk.rb +12 -5
  4. data/lib/linux_admin/registration_system.rb +8 -4
  5. data/lib/linux_admin/scap.rb +1 -1
  6. data/lib/linux_admin/service/sys_v_init_service.rb +2 -1
  7. data/lib/linux_admin/service/systemd_service.rb +6 -2
  8. data/lib/linux_admin/version.rb +1 -1
  9. metadata +8 -100
  10. data/lib/linux_admin/registration_system/rhn.rb +0 -111
  11. data/spec/chrony_spec.rb +0 -64
  12. data/spec/common_spec.rb +0 -37
  13. data/spec/data/rhn/output_rhn-channel_list +0 -2
  14. data/spec/data/rhn/output_rhn-channel_list_available +0 -4
  15. data/spec/data/rhn/systemid +0 -57
  16. data/spec/data/rhn/systemid.missing_system_id +0 -57
  17. data/spec/data/rpm/cmd_output_for_list_installed +0 -20
  18. data/spec/data/subscription_manager/output_list_all_available +0 -42
  19. data/spec/data/subscription_manager/output_list_installed_not_subscribed +0 -19
  20. data/spec/data/subscription_manager/output_list_installed_subscribed +0 -19
  21. data/spec/data/subscription_manager/output_orgs +0 -6
  22. data/spec/data/subscription_manager/output_repos +0 -18
  23. data/spec/data/time_date/timedatectl_output +0 -14
  24. data/spec/data/yum/first.repo +0 -19
  25. data/spec/data/yum/output_repo_list +0 -13
  26. data/spec/data/yum/output_repoquery_multiple +0 -3
  27. data/spec/data/yum/output_repoquery_single +0 -1
  28. data/spec/data/yum/second.repo +0 -9
  29. data/spec/deb_spec.rb +0 -52
  30. data/spec/disk_spec.rb +0 -307
  31. data/spec/distro_spec.rb +0 -77
  32. data/spec/dns_spec.rb +0 -105
  33. data/spec/etc_issue_spec.rb +0 -37
  34. data/spec/fstab_spec.rb +0 -132
  35. data/spec/hardware_spec.rb +0 -46
  36. data/spec/hosts_spec.rb +0 -150
  37. data/spec/ip_address_spec.rb +0 -148
  38. data/spec/logical_volume_spec.rb +0 -166
  39. data/spec/mountable_spec.rb +0 -182
  40. data/spec/network_interface/network_interface_rh_spec.rb +0 -291
  41. data/spec/network_interface_spec.rb +0 -284
  42. data/spec/partition_spec.rb +0 -24
  43. data/spec/physical_volume_spec.rb +0 -101
  44. data/spec/registration_system_spec.rb +0 -85
  45. data/spec/rhn_spec.rb +0 -144
  46. data/spec/rpm_spec.rb +0 -85
  47. data/spec/scap_spec.rb +0 -48
  48. data/spec/service/sys_v_init_service_spec.rb +0 -127
  49. data/spec/service/systemd_service_spec.rb +0 -133
  50. data/spec/service_spec.rb +0 -54
  51. data/spec/spec_helper.rb +0 -116
  52. data/spec/ssh_spec.rb +0 -53
  53. data/spec/subscription_manager_spec.rb +0 -228
  54. data/spec/system_spec.rb +0 -15
  55. data/spec/time_date_spec.rb +0 -106
  56. data/spec/volume_group_spec.rb +0 -99
  57. data/spec/yum_spec.rb +0 -155
@@ -1,24 +0,0 @@
1
- describe LinuxAdmin::Partition do
2
- before(:each) do
3
- @disk = LinuxAdmin::Disk.new :path => '/dev/sda'
4
- @partition = LinuxAdmin::Partition.new :disk => @disk, :id => 2
5
- end
6
-
7
- describe "#path" do
8
- it "returns partition path" do
9
- expect(@partition.path).to eq('/dev/sda2')
10
- end
11
- end
12
-
13
- describe "#mount" do
14
- context "mount_point not specified" do
15
- it "sets default mount_point" do
16
- expect(described_class).to receive(:mount_point_exists?).and_return(false)
17
- expect(File).to receive(:directory?).with('/mnt/sda2').and_return(true)
18
- expect(LinuxAdmin::Common).to receive(:run!)
19
- @partition.mount
20
- expect(@partition.mount_point).to eq('/mnt/sda2')
21
- end
22
- end
23
- end
24
- end
@@ -1,101 +0,0 @@
1
- describe LinuxAdmin::PhysicalVolume do
2
- before(:each) do
3
- @physical_volumes = <<eos
4
- /dev/vda2:vg_foobar:24139776:-1:8:8:-1:32768:368:0:368:pxR32D-YkC2-PfHe-zOwb-eaGD-9Ar0-mAOl9u
5
- eos
6
-
7
- @groups = <<eos
8
- vg_foobar:r/w:772:-1:0:2:2:-1:0:1:1:12058624:32768:368:368:0:tILZUF-IspH-H90I-pT5j-vVFl-b76L-zWx3CW
9
- eos
10
- end
11
-
12
- after(:each) do
13
- # reset local copies of volumes / groups
14
- LinuxAdmin::LogicalVolume.instance_variable_set(:@lvs, nil)
15
- described_class.instance_variable_set(:@pvs, nil)
16
- LinuxAdmin::VolumeGroup.instance_variable_set(:@vgs, nil)
17
- end
18
-
19
- describe "#attach_to" do
20
- it "uses vgextend" do
21
- vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
22
- pv = described_class.new :device_name => '/dev/hda'
23
- expect(LinuxAdmin::Common).to receive(:run!)
24
- .with(LinuxAdmin::Common.cmd(:vgextend),
25
- :params => ['vg', '/dev/hda'])
26
- pv.attach_to(vg)
27
- end
28
-
29
- it "assigns volume group to physical volume" do
30
- vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
31
- pv = described_class.new :device_name => '/dev/hda'
32
- allow(LinuxAdmin::Common).to receive(:run!)
33
- pv.attach_to(vg)
34
- expect(pv.volume_group).to eq(vg)
35
- end
36
-
37
- it "returns self" do
38
- vg = LinuxAdmin::VolumeGroup.new :name => 'vg'
39
- pv = described_class.new :device_name => '/dev/hda'
40
- allow(LinuxAdmin::Common).to receive(:run!)
41
- expect(pv.attach_to(vg)).to eq(pv)
42
- end
43
- end
44
-
45
- describe "#create" do
46
- before do
47
- @disk = LinuxAdmin::Disk.new :path => '/dev/hda'
48
- allow(@disk).to receive(:size)
49
- end
50
-
51
- let(:disk) {@disk}
52
-
53
- it "uses pvcreate" do
54
- described_class.instance_variable_set(:@pvs, [])
55
- expect(LinuxAdmin::Common).to receive(:run!)
56
- .with(LinuxAdmin::Common.cmd(:pvcreate),
57
- :params => {nil => '/dev/hda'})
58
- described_class.create disk
59
- end
60
-
61
- it "returns new physical volume" do
62
- allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
63
- pv = described_class.create disk
64
- expect(pv).to be_an_instance_of(described_class)
65
- expect(pv.device_name).to eq('/dev/hda')
66
- end
67
-
68
- it "adds physical volume to local registry" do
69
- allow(LinuxAdmin::Common).to receive_messages(:run! => double(:output => ""))
70
- pv = described_class.create disk
71
- expect(described_class.scan).to include(pv)
72
- end
73
- end
74
-
75
- describe "#scan" do
76
- it "uses pvdisplay" do
77
- expect(LinuxAdmin::Common).to receive(:run!)
78
- .with(LinuxAdmin::Common.cmd(:pvdisplay),
79
- :params => {'-c' => nil})
80
- .and_return(double(:output => @physical_volumes))
81
- expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @groups)) # stub out call to vgdisplay
82
- described_class.scan
83
- end
84
-
85
- it "returns local physical volumes" do
86
- expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @physical_volumes), double(:output => @groups))
87
- pvs = described_class.scan
88
-
89
- expect(pvs[0]).to be_an_instance_of(described_class)
90
- expect(pvs[0].device_name).to eq('/dev/vda2')
91
- expect(pvs[0].size).to eq(24139776)
92
- end
93
-
94
- it "resolves volume group references" do
95
- expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @physical_volumes), double(:output => @groups))
96
- pvs = described_class.scan
97
- expect(pvs[0].volume_group).to be_an_instance_of(LinuxAdmin::VolumeGroup)
98
- expect(pvs[0].volume_group.name).to eq('vg_foobar')
99
- end
100
- end
101
- end
@@ -1,85 +0,0 @@
1
- describe LinuxAdmin::RegistrationSystem do
2
- context ".registration_type" do
3
- it "when registered Subscription Manager" do
4
- stub_registered_to_system(:sm)
5
- expect(described_class.registration_type).to eq(LinuxAdmin::SubscriptionManager)
6
- end
7
-
8
- it "when registered RHN" do
9
- stub_registered_to_system(:sm, :rhn)
10
- expect(described_class.registration_type).to eq(LinuxAdmin::Rhn)
11
- end
12
-
13
- it "when unregistered" do
14
- stub_registered_to_system(nil)
15
- expect(described_class.registration_type).to eq(described_class)
16
- end
17
-
18
- it "should memoize results" do
19
- expect(described_class).to receive(:registration_type_uncached).once.and_return("anything_non_nil")
20
- described_class.registration_type
21
- described_class.registration_type
22
- end
23
-
24
- it "with reload should refresh results" do
25
- expect(described_class).to receive(:registration_type_uncached).twice.and_return("anything_non_nil")
26
- described_class.registration_type
27
- described_class.registration_type(true)
28
- end
29
- end
30
-
31
- context "#registered?" do
32
- it "when unregistered" do
33
- stub_registered_to_system(nil)
34
- expect(described_class.registered?).to be_falsey
35
- end
36
-
37
- context "SubscriptionManager" do
38
- it "with no args" do
39
- expect(LinuxAdmin::Common).to receive(:run).with("subscription-manager identity").and_return(double(:exit_status => 0))
40
-
41
- LinuxAdmin::SubscriptionManager.new.registered?
42
- end
43
-
44
- it "with a proxy" do
45
- expect(LinuxAdmin::Common).to receive(:run).with(
46
- "subscription-manager identity",
47
- :params => {
48
- "--proxy=" => "https://example.com",
49
- "--proxyuser=" => "user",
50
- "--proxypassword=" => "pass"
51
- }
52
- ).and_return(double(:exit_status => 0))
53
-
54
- LinuxAdmin::SubscriptionManager.new.registered?(
55
- :proxy_address => "https://example.com",
56
- :proxy_username => "user",
57
- :proxy_password => "pass"
58
- )
59
- end
60
- end
61
- end
62
-
63
- context ".method_missing" do
64
- before do
65
- stub_registered_to_system(:rhn)
66
- end
67
-
68
- it "exists on the subclass" do
69
- expect(LinuxAdmin::RegistrationSystem.registered?).to be_truthy
70
- end
71
-
72
- it "does not exist on the subclass" do
73
- expect { LinuxAdmin::RegistrationSystem.organizations }.to raise_error(NotImplementedError)
74
- end
75
-
76
- it "is an unknown method" do
77
- expect { LinuxAdmin::RegistrationSystem.method_does_not_exist }.to raise_error(NoMethodError)
78
- end
79
- end
80
-
81
- def stub_registered_to_system(*system)
82
- allow_any_instance_of(LinuxAdmin::SubscriptionManager).to receive_messages(:registered? => (system.include?(:sm)))
83
- allow_any_instance_of(LinuxAdmin::Rhn).to receive_messages(:registered? => (system.include?(:rhn)))
84
- end
85
- end
@@ -1,144 +0,0 @@
1
- describe LinuxAdmin::Rhn do
2
- context "#registered?" do
3
- it "with registered system_id" do
4
- allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid"))
5
- expect(described_class.new).to be_registered
6
- end
7
-
8
- it "with unregistered system_id" do
9
- allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid.missing_system_id"))
10
- expect(described_class.new).to_not be_registered
11
- end
12
-
13
- it "with missing systemid file" do
14
- allow_any_instance_of(described_class).to receive_messages(:systemid_file => data_file_path("rhn/systemid.missing_file"))
15
- expect(described_class.new).to_not be_registered
16
- end
17
- end
18
-
19
- context "#register" do
20
- it "no username or activation key" do
21
- expect { described_class.new.register({}) }.to raise_error(ArgumentError)
22
- end
23
-
24
- context "with username and password" do
25
- let(:base_options) { {:username => "SomeUser@SomeDomain.org",
26
- :password => "SomePass",
27
- :org => "2",
28
- :proxy_address => "1.2.3.4",
29
- :proxy_username => "ProxyUser",
30
- :proxy_password => "ProxyPass",
31
- :server_cert => "/path/to/cert",
32
- }
33
- }
34
- let(:run_params) { {:params=>{"--username="=>"SomeUser@SomeDomain.org", "--password="=>"SomePass", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"}} }
35
-
36
- it "with server_url" do
37
- run_params.store_path(:params, "--systemorgid=", "2")
38
- run_params.store_path(:params, "--serverUrl=", "https://server.url")
39
- run_params.store_path(:params, "--sslCACert=", "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT")
40
- base_options.store_path(:server_url, "https://server.url")
41
-
42
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhnreg_ks", run_params)
43
- expect(LinuxAdmin::Rpm).to receive(:upgrade).with("http://server.url/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm")
44
- expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => "1.0"})
45
-
46
- described_class.new.register(base_options)
47
- end
48
-
49
- it "without server_url" do
50
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhnreg_ks", run_params)
51
- expect_any_instance_of(described_class).not_to receive(:install_server_certificate)
52
- expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
53
-
54
- described_class.new.register(base_options)
55
- end
56
- end
57
-
58
- it "with activation key" do
59
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhnreg_ks",
60
- :params => {"--activationkey=" => "123abc",
61
- "--proxy=" => "1.2.3.4",
62
- "--proxyUser=" => "ProxyUser",
63
- "--proxyPassword=" => "ProxyPass"})
64
- expect(LinuxAdmin::Rpm).to receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
65
-
66
- described_class.new.register(
67
- :activationkey => "123abc",
68
- :proxy_address => "1.2.3.4",
69
- :proxy_username => "ProxyUser",
70
- :proxy_password => "ProxyPass",
71
- )
72
- end
73
- end
74
-
75
- it "#enable_channel" do
76
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhn-channel -a",
77
- :params => {"--user=" => "SomeUser",
78
- "--password=" => "SomePass",
79
- "--channel=" => 123})
80
-
81
- described_class.new.enable_channel(123, :username => "SomeUser", :password => "SomePass")
82
- end
83
-
84
- it "#enabled_channels" do
85
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhn-channel -l")
86
- .and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
87
-
88
- expect(described_class.new.enabled_channels).to eq(["rhel-x86_64-server-6", "rhel-x86_64-server-6-cf-me-2"])
89
- end
90
-
91
- it "#disable_channel" do
92
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhn-channel -r", :params => {"--user=" => "SomeUser",
93
- "--password=" => "SomePass",
94
- "--channel=" => 123})
95
-
96
- described_class.new.disable_channel(123, :username => "SomeUser", :password => "SomePass")
97
- end
98
-
99
- it "#available_channels" do
100
- credentials = {
101
- :username => "some_user",
102
- :password => "password"
103
- }
104
- expected = [
105
- "rhel-x86_64-server-6-cf-me-2",
106
- "rhel-x86_64-server-6-cf-me-2-beta",
107
- "rhel-x86_64-server-6-cf-me-3",
108
- "rhel-x86_64-server-6-cf-me-3-beta"
109
- ]
110
- cmd = "rhn-channel -L"
111
- params = {
112
- :params => {
113
- "--user=" => "some_user",
114
- "--password=" => "password"
115
- }
116
- }
117
-
118
- expect(LinuxAdmin::Common).to receive(:run!).once.with(cmd, params)
119
- .and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
120
-
121
- expect(described_class.new.available_channels(credentials)).to eq(expected)
122
- end
123
-
124
- it "#all_repos" do
125
- credentials = {
126
- :username => "some_user",
127
- :password => "password"
128
- }
129
- expected = [
130
- {:repo_id => "rhel-x86_64-server-6-cf-me-2", :enabled => true},
131
- {:repo_id => "rhel-x86_64-server-6-cf-me-2-beta", :enabled => false},
132
- {:repo_id => "rhel-x86_64-server-6-cf-me-3", :enabled => false},
133
- {:repo_id => "rhel-x86_64-server-6-cf-me-3-beta", :enabled => false},
134
- {:repo_id => "rhel-x86_64-server-6", :enabled => true}
135
- ]
136
-
137
- expect(LinuxAdmin::Common).to receive(:run!).once
138
- .and_return(double(:output => sample_output("rhn/output_rhn-channel_list_available")))
139
- expect(LinuxAdmin::Common).to receive(:run!).once.with("rhn-channel -l")
140
- .and_return(double(:output => sample_output("rhn/output_rhn-channel_list")))
141
-
142
- expect(described_class.new.all_repos(credentials)).to eq(expected)
143
- end
144
- end
@@ -1,85 +0,0 @@
1
- describe LinuxAdmin::Rpm do
2
- it ".list_installed" do
3
- allow(LinuxAdmin::Common).to receive(:run!)
4
- .and_return(double(:output => sample_output("rpm/cmd_output_for_list_installed")))
5
- expect(described_class.list_installed).to eq({
6
- "ruby193-rubygem-some_really_long_name" =>"1.0.7-1.el6",
7
- "fipscheck-lib" =>"1.2.0-7.el6",
8
- "aic94xx-firmware" =>"30-2.el6",
9
- "latencytop-common" =>"0.5-9.el6",
10
- "uuid" =>"1.6.1-10.el6",
11
- "ConsoleKit" =>"0.4.1-3.el6",
12
- "cpuspeed" =>"1.5-19.el6",
13
- "mailcap" =>"2.1.31-2.el6",
14
- "freetds" =>"0.82-7.1.el6cf",
15
- "elinks" =>"0.12-0.21.pre5.el6_3",
16
- "abrt-cli" =>"2.0.8-15.el6",
17
- "libattr" =>"2.4.44-7.el6",
18
- "passwd" =>"0.77-4.el6_2.2",
19
- "vim-enhanced" =>"7.2.411-1.8.el6",
20
- "popt" =>"1.13-7.el6",
21
- "hesiod" =>"3.1.0-19.el6",
22
- "pinfo" =>"0.6.9-12.el6",
23
- "libpng" =>"1.2.49-1.el6_2",
24
- "libdhash" =>"0.4.2-9.el6",
25
- "zlib-devel" =>"1.2.3-29.el6",
26
- })
27
- end
28
-
29
- it ".import_key" do
30
- expect(LinuxAdmin::Common).to receive(:run!).with("rpm", :params => {"--import" => "abc"})
31
- expect { described_class.import_key("abc") }.to_not raise_error
32
- end
33
-
34
- describe "#info" do
35
- it "returns package metadata" do
36
- # as output w/ rpm -qi ruby on F19
37
- data = <<EOS
38
- Name : ruby
39
- Version : 2.0.0.247
40
- Release : 15.fc19
41
- Architecture: x86_64
42
- Install Date: Sat 19 Oct 2013 08:17:20 PM EDT
43
- Group : Development/Languages
44
- Size : 64473
45
- License : (Ruby or BSD) and Public Domain
46
- Signature : RSA/SHA256, Thu 01 Aug 2013 02:07:03 PM EDT, Key ID 07477e65fb4b18e6
47
- Source RPM : ruby-2.0.0.247-15.fc19.src.rpm
48
- Build Date : Wed 31 Jul 2013 08:26:49 AM EDT
49
- Build Host : buildvm-16.phx2.fedoraproject.org
50
- Relocations : (not relocatable)
51
- Packager : Fedora Project
52
- Vendor : Fedora Project
53
- URL : http://ruby-lang.org/
54
- Summary : An interpreter of object-oriented scripting language
55
- Description :
56
- Ruby is the interpreted scripting language for quick and easy
57
- object-oriented programming. It has many features to process text
58
- files and to do system management tasks (as in Perl). It is simple,
59
- straight-forward, and extensible.
60
- EOS
61
- arguments = [described_class.rpm_cmd, :params => {"-qi" => "ruby"}]
62
- result = AwesomeSpawn::CommandResult.new("", data, "", 0)
63
- expect(LinuxAdmin::Common).to receive(:run!).with(*arguments).and_return(result)
64
- metadata = described_class.info("ruby")
65
- expect(metadata['name']).to eq('ruby')
66
- expect(metadata['version']).to eq('2.0.0.247')
67
- expect(metadata['release']).to eq('15.fc19')
68
- expect(metadata['architecture']).to eq('x86_64')
69
- expect(metadata['group']).to eq('Development/Languages')
70
- expect(metadata['size']).to eq('64473')
71
- expect(metadata['license']).to eq('(Ruby or BSD) and Public Domain')
72
- expect(metadata['source_rpm']).to eq('ruby-2.0.0.247-15.fc19.src.rpm')
73
- expect(metadata['build_host']).to eq('buildvm-16.phx2.fedoraproject.org')
74
- expect(metadata['packager']).to eq('Fedora Project')
75
- expect(metadata['vendor']).to eq('Fedora Project')
76
- expect(metadata['summary']).to eq('An interpreter of object-oriented scripting language')
77
- end
78
- end
79
-
80
- it ".upgrade" do
81
- expect(LinuxAdmin::Common).to receive(:run).with("rpm -U", :params => {nil => "abc"})
82
- .and_return(double(:exit_status => 0))
83
- expect(described_class.upgrade("abc")).to be_truthy
84
- end
85
- end
@@ -1,48 +0,0 @@
1
- describe LinuxAdmin::Scap do
2
- subject { described_class.new("rhel7") }
3
-
4
- describe "#lockdown" do
5
- it "raises if given no rules" do
6
- allow(described_class).to receive(:openscap_available?).and_return(true)
7
- allow(described_class).to receive(:ssg_available?).and_return(true)
8
-
9
- expect { subject.lockdown("value1" => true) }.to raise_error(RuntimeError)
10
- end
11
- end
12
-
13
- describe "#profile_xml (private)" do
14
- it "creates a Profile tag" do
15
- profile_xml = subject.send(:profile_xml, "test-profile", [], {})
16
- expect(profile_xml).to match(%r{<Profile id="test-profile">.*</Profile>}m)
17
- end
18
-
19
- it "creates a title tag" do
20
- profile_xml = subject.send(:profile_xml, "test-profile", [], {})
21
- expect(profile_xml).to match(%r{<title>test-profile</title>}m)
22
- end
23
-
24
- it "creates a description tag" do
25
- profile_xml = subject.send(:profile_xml, "test-profile", [], {})
26
- expect(profile_xml).to match(%r{<description>test-profile</description>}m)
27
- end
28
-
29
- it "creates a select tag for each rule" do
30
- profile_xml = subject.send(:profile_xml, "test-profile", %w(rule1 rule2), {})
31
- expect(profile_xml).to match(%r{<select idref="rule1" selected="true"/>}m)
32
- expect(profile_xml).to match(%r{<select idref="rule2" selected="true"/>}m)
33
- end
34
-
35
- it "creates a refine-value tag for each value" do
36
- profile_xml = subject.send(:profile_xml, "test-profile", [], "key1" => "val1", "key2" => "val2")
37
- expect(profile_xml).to match(%r{<refine-value idref="key1" selector="val1"/>}m)
38
- expect(profile_xml).to match(%r{<refine-value idref="key2" selector="val2"/>}m)
39
- end
40
- end
41
-
42
- describe ".ds_file" do
43
- it "returns the platform ds file path" do
44
- file = described_class.ds_file("rhel7")
45
- expect(file.to_s).to eq("/usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml")
46
- end
47
- end
48
- end