beaker 4.38.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +36 -11
- data/.rubocop.yml +75 -0
- data/.rubocop_todo.yml +239 -0
- data/CHANGELOG.md +88 -33
- data/Gemfile +16 -4
- data/HISTORY.md +103 -0
- data/Rakefile +101 -112
- data/acceptance/config/acceptance-options.rb +1 -1
- data/acceptance/config/base/acceptance-options.rb +2 -2
- data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
- data/acceptance/config/subcommands/acceptance-options.rb +2 -2
- data/acceptance/fixtures/module/Gemfile +1 -1
- data/acceptance/fixtures/module/Rakefile +3 -3
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +16 -23
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +1 -2
- data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
- data/acceptance/lib/helpers/test_helper.rb +7 -6
- data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
- data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +7 -8
- data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +9 -7
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +15 -21
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +23 -30
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +21 -16
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +7 -7
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +30 -38
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +14 -18
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +8 -14
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +7 -11
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +5 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +4 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +8 -8
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +4 -6
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
- data/acceptance/tests/base/dsl/structure_test.rb +9 -21
- data/acceptance/tests/base/host/file_test.rb +8 -8
- data/acceptance/tests/base/host/group_test.rb +2 -3
- data/acceptance/tests/base/host/host_test.rb +69 -66
- data/acceptance/tests/base/host/packages.rb +27 -30
- data/acceptance/tests/base/host/packages_unix.rb +0 -55
- data/acceptance/tests/base/host/user_test.rb +2 -3
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
- data/acceptance/tests/base/test_suite/export.rb +6 -9
- data/acceptance/tests/install/from_file.rb +3 -5
- data/acceptance/tests/load_path_bootstrap.rb +1 -1
- data/acceptance/tests/subcommands/destroy.rb +19 -21
- data/acceptance/tests/subcommands/exec.rb +0 -1
- data/acceptance/tests/subcommands/init.rb +2 -3
- data/acceptance/tests/subcommands/provision.rb +0 -1
- data/beaker.gemspec +10 -14
- data/docs/concepts/argument_processing_and_precedence.md +1 -10
- data/docs/concepts/style_guide.md +1 -1
- data/docs/how_to/debug_beaker_tests.md +13 -13
- data/docs/how_to/hosts/eos.md +2 -12
- data/docs/how_to/install_puppet.md +0 -18
- data/docs/how_to/test_arbitrary_beaker_versions.md +2 -2
- data/docs/how_to/the_beaker_dsl.md +0 -2
- data/lib/beaker/cli.rb +63 -74
- data/lib/beaker/command.rb +22 -30
- data/lib/beaker/command_factory.rb +4 -3
- data/lib/beaker/dsl/assertions.rb +7 -19
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +5 -9
- data/lib/beaker/dsl/helpers/host_helpers.rb +72 -133
- data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
- data/lib/beaker/dsl/helpers/web_helpers.rb +20 -28
- data/lib/beaker/dsl/helpers.rb +2 -4
- data/lib/beaker/dsl/outcomes.rb +17 -19
- data/lib/beaker/dsl/patterns.rb +1 -3
- data/lib/beaker/dsl/roles.rb +18 -21
- data/lib/beaker/dsl/structure.rb +55 -67
- data/lib/beaker/dsl/test_tagging.rb +7 -10
- data/lib/beaker/dsl/wrappers.rb +15 -16
- data/lib/beaker/dsl.rb +2 -3
- data/lib/beaker/host/aix/exec.rb +1 -1
- data/lib/beaker/host/aix/file.rb +0 -1
- data/lib/beaker/host/aix/group.rb +3 -3
- data/lib/beaker/host/aix/user.rb +3 -3
- data/lib/beaker/host/aix.rb +3 -4
- data/lib/beaker/host/cisco.rb +36 -48
- data/lib/beaker/host/eos.rb +4 -30
- data/lib/beaker/host/freebsd/exec.rb +1 -1
- data/lib/beaker/host/freebsd/pkg.rb +3 -3
- data/lib/beaker/host/freebsd.rb +9 -12
- data/lib/beaker/host/mac/exec.rb +5 -5
- data/lib/beaker/host/mac/group.rb +13 -13
- data/lib/beaker/host/mac/pkg.rb +6 -109
- data/lib/beaker/host/mac/user.rb +7 -7
- data/lib/beaker/host/mac.rb +8 -9
- data/lib/beaker/host/pswindows/exec.rb +70 -74
- data/lib/beaker/host/pswindows/file.rb +4 -6
- data/lib/beaker/host/pswindows/group.rb +5 -5
- data/lib/beaker/host/pswindows/pkg.rb +17 -17
- data/lib/beaker/host/pswindows/user.rb +4 -4
- data/lib/beaker/host/pswindows.rb +4 -3
- data/lib/beaker/host/unix/exec.rb +86 -88
- data/lib/beaker/host/unix/file.rb +41 -47
- data/lib/beaker/host/unix/group.rb +3 -3
- data/lib/beaker/host/unix/pkg.rb +158 -421
- data/lib/beaker/host/unix/user.rb +4 -4
- data/lib/beaker/host/unix.rb +18 -20
- data/lib/beaker/host/windows/exec.rb +20 -20
- data/lib/beaker/host/windows/file.rb +5 -5
- data/lib/beaker/host/windows/group.rb +5 -5
- data/lib/beaker/host/windows/pkg.rb +6 -57
- data/lib/beaker/host/windows/user.rb +4 -4
- data/lib/beaker/host/windows.rb +13 -13
- data/lib/beaker/host.rb +82 -139
- data/lib/beaker/host_prebuilt_steps.rb +121 -233
- data/lib/beaker/hypervisor/noop.rb +2 -4
- data/lib/beaker/hypervisor.rb +46 -63
- data/lib/beaker/local_connection.rb +4 -6
- data/lib/beaker/logger.rb +71 -85
- data/lib/beaker/logger_junit.rb +22 -26
- data/lib/beaker/network_manager.rb +40 -43
- data/lib/beaker/options/command_line_parser.rb +12 -23
- data/lib/beaker/options/hosts_file_parser.rb +34 -25
- data/lib/beaker/options/options_file_parser.rb +3 -6
- data/lib/beaker/options/options_hash.rb +3 -10
- data/lib/beaker/options/parser.rb +89 -105
- data/lib/beaker/options/presets.rb +114 -123
- data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
- data/lib/beaker/options/validator.rb +26 -31
- data/lib/beaker/perf.rb +29 -34
- data/lib/beaker/platform.rb +38 -46
- data/lib/beaker/result.rb +7 -6
- data/lib/beaker/shared/error_handler.rb +8 -10
- data/lib/beaker/shared/fog_credentials.rb +5 -9
- data/lib/beaker/shared/host_manager.rb +40 -46
- data/lib/beaker/shared/options_resolver.rb +3 -7
- data/lib/beaker/shared/repetition.rb +6 -8
- data/lib/beaker/shared/semvar.rb +39 -43
- data/lib/beaker/shared/timed.rb +2 -5
- data/lib/beaker/shared.rb +1 -1
- data/lib/beaker/ssh_connection.rb +46 -55
- data/lib/beaker/subcommand.rb +23 -30
- data/lib/beaker/subcommands/subcommand_util.rb +4 -4
- data/lib/beaker/tasks/quick_start.rb +5 -10
- data/lib/beaker/tasks/rake_task.rb +26 -28
- data/lib/beaker/tasks/test.rb +4 -4
- data/lib/beaker/test_case.rb +15 -27
- data/lib/beaker/test_suite.rb +35 -39
- data/lib/beaker/test_suite_result.rb +52 -57
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +5 -6
- data/spec/beaker/cli_spec.rb +135 -153
- data/spec/beaker/command_spec.rb +64 -58
- data/spec/beaker/dsl/assertions_spec.rb +38 -47
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +114 -135
- data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +30 -36
- data/spec/beaker/dsl/outcomes_spec.rb +15 -14
- data/spec/beaker/dsl/roles_spec.rb +170 -132
- data/spec/beaker/dsl/structure_spec.rb +181 -163
- data/spec/beaker/dsl/test_tagging_spec.rb +94 -95
- data/spec/beaker/dsl/wrappers_spec.rb +39 -40
- data/spec/beaker/host/aix_spec.rb +14 -14
- data/spec/beaker/host/cisco_spec.rb +92 -102
- data/spec/beaker/host/eos_spec.rb +15 -36
- data/spec/beaker/host/freebsd/exec_spec.rb +5 -8
- data/spec/beaker/host/freebsd/pkg_spec.rb +29 -29
- data/spec/beaker/host/mac/exec_spec.rb +4 -5
- data/spec/beaker/host/mac/group_spec.rb +47 -56
- data/spec/beaker/host/mac/user_spec.rb +53 -62
- data/spec/beaker/host/pswindows/exec_spec.rb +36 -35
- data/spec/beaker/host/pswindows/file_spec.rb +21 -18
- data/spec/beaker/host/pswindows/user_spec.rb +17 -23
- data/spec/beaker/host/pswindows_spec.rb +14 -14
- data/spec/beaker/host/unix/exec_spec.rb +87 -92
- data/spec/beaker/host/unix/file_spec.rb +76 -82
- data/spec/beaker/host/unix/pkg_spec.rb +165 -407
- data/spec/beaker/host/unix_spec.rb +11 -207
- data/spec/beaker/host/windows/exec_spec.rb +32 -34
- data/spec/beaker/host/windows/file_spec.rb +22 -23
- data/spec/beaker/host/windows/group_spec.rb +17 -19
- data/spec/beaker/host/windows/pkg_spec.rb +10 -13
- data/spec/beaker/host/windows/user_spec.rb +17 -23
- data/spec/beaker/host/windows_spec.rb +39 -39
- data/spec/beaker/host_prebuilt_steps_spec.rb +193 -341
- data/spec/beaker/host_spec.rb +241 -312
- data/spec/beaker/hypervisor/hypervisor_spec.rb +38 -63
- data/spec/beaker/localhost_connection_spec.rb +14 -13
- data/spec/beaker/logger_junit_spec.rb +22 -34
- data/spec/beaker/logger_spec.rb +174 -155
- data/spec/beaker/network_manager_spec.rb +27 -27
- data/spec/beaker/options/command_line_parser_spec.rb +20 -23
- data/spec/beaker/options/data/hosts_preserved.yml +395 -0
- data/spec/beaker/options/hosts_file_parser_spec.rb +36 -31
- data/spec/beaker/options/options_file_parser_spec.rb +4 -7
- data/spec/beaker/options/options_hash_spec.rb +7 -9
- data/spec/beaker/options/parser_spec.rb +187 -187
- data/spec/beaker/options/presets_spec.rb +8 -10
- data/spec/beaker/options/subcommand_options_parser_spec.rb +15 -15
- data/spec/beaker/options/validator_spec.rb +27 -28
- data/spec/beaker/perf_spec.rb +32 -34
- data/spec/beaker/platform_spec.rb +27 -37
- data/spec/beaker/shared/error_handler_spec.rb +8 -17
- data/spec/beaker/shared/fog_credentials_spec.rb +30 -30
- data/spec/beaker/shared/host_manager_spec.rb +55 -89
- data/spec/beaker/shared/options_resolver_spec.rb +9 -12
- data/spec/beaker/shared/repetition_spec.rb +24 -31
- data/spec/beaker/shared/semvar_spec.rb +21 -26
- data/spec/beaker/ssh_connection_spec.rb +85 -90
- data/spec/beaker/subcommand/subcommand_util_spec.rb +40 -37
- data/spec/beaker/subcommand_spec.rb +89 -89
- data/spec/beaker/test_case_spec.rb +33 -62
- data/spec/beaker/test_suite_spec.rb +153 -160
- data/spec/helpers.rb +48 -53
- data/spec/matchers.rb +9 -8
- data/spec/mocks.rb +6 -11
- data/spec/spec_helper.rb +0 -4
- metadata +60 -85
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
- data/acceptance/tests/base/external_resources_test.rb +0 -31
- data/spec/beaker/host/mac_spec.rb +0 -113
- data/spec/mock_fission.rb +0 -60
- data/spec/mock_vsphere.rb +0 -314
- data/spec/mock_vsphere_helper.rb +0 -183
@@ -3,15 +3,15 @@ require "spec_helper"
|
|
3
3
|
module Beaker
|
4
4
|
module Options
|
5
5
|
describe HostsFileParser do
|
6
|
-
|
7
|
-
let(:
|
8
|
-
let(:
|
6
|
+
let(:parser) { described_class }
|
7
|
+
let(:filepath) { File.join(__dir__, "data", "hosts.cfg") }
|
8
|
+
let(:filepath_yaml) { File.join(__dir__, "data", "hosts_preserved.yml") }
|
9
9
|
|
10
10
|
describe '#parse_hosts_file' do
|
11
11
|
it "can correctly read a host file" do
|
12
12
|
FakeFS.deactivate!
|
13
13
|
config = parser.parse_hosts_file(filepath)
|
14
|
-
expect(config).to be === {:HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>[
|
14
|
+
expect(config).to be === { :HOSTS => { :"pe-ubuntu-lucid" => { :roles => %w[agent dashboard database master], :vmname => "pe-ubuntu-lucid", :platform => "ubuntu-10.04-i386", :snapshot => "clean-w-keys", :hypervisor => "fusion" }, :"pe-centos6" => { :roles => ["agent"], :vmname => "pe-centos6", :platform => "el-6-i386", :hypervisor => "fusion", :snapshot => "clean-w-keys" } }, :nfs_server => "none", :consoleport => 443 }
|
15
15
|
end
|
16
16
|
|
17
17
|
it "can merge CONFIG section into overall hash" do
|
@@ -23,54 +23,59 @@ module Beaker
|
|
23
23
|
|
24
24
|
it "returns empty configuration when no file provided" do
|
25
25
|
FakeFS.deactivate!
|
26
|
-
expect(parser.parse_hosts_file
|
26
|
+
expect(parser.parse_hosts_file).to be === { :HOSTS => {} }
|
27
27
|
end
|
28
28
|
|
29
29
|
it "raises an error on no file found" do
|
30
30
|
FakeFS.deactivate!
|
31
|
-
expect{parser.parse_hosts_file("not a valid path")}.to raise_error(/is not a valid path/)
|
31
|
+
expect { parser.parse_hosts_file("not a valid path") }.to raise_error(/is not a valid path/)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "raises an error on bad yaml file" do
|
35
35
|
FakeFS.deactivate!
|
36
|
-
expect(
|
36
|
+
expect(File).to receive(:exist?).and_return(true)
|
37
37
|
|
38
38
|
expect { parser.parse_hosts_file("not a valid path") }.to raise_error(Errno::ENOENT)
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'returns a #new_host_options hash if given no arguments' do
|
42
42
|
host_options = parser.parse_hosts_file
|
43
|
-
expect(
|
43
|
+
expect(host_options).to be === parser.new_host_options
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'passes a YAML.load call through to #merge_hosts_yaml' do
|
47
47
|
yaml_string = 'not actually yaml, but that wont matter'
|
48
|
-
expect(
|
49
|
-
expect(
|
50
|
-
parser.parse_hosts_file(
|
48
|
+
expect(File).to receive(:exist?).and_return(true)
|
49
|
+
expect(File).to receive(:read).and_return(yaml_string)
|
50
|
+
parser.parse_hosts_file(yaml_string)
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'processes ERB in the host YAML successfully' do
|
54
54
|
yaml_string = '1 plus 2: <%= 1 + 2 %>'
|
55
|
-
expect(
|
56
|
-
expect(
|
57
|
-
beaker_options_hash = parser.parse_hosts_file(
|
55
|
+
expect(File).to receive(:exist?).and_return(true)
|
56
|
+
expect(File).to receive(:read).and_return(yaml_string)
|
57
|
+
beaker_options_hash = parser.parse_hosts_file(yaml_string)
|
58
58
|
expect(beaker_options_hash['1 plus 2']).to eq(3)
|
59
59
|
end
|
60
|
+
|
61
|
+
it "can correctly read a hosts_preserved.yml file" do
|
62
|
+
FakeFS.deactivate!
|
63
|
+
expect { parser.parse_hosts_file(filepath_yaml) }.not_to raise_error
|
64
|
+
expect(parser.parse_hosts_file(filepath_yaml).dig(:HOSTS, :"primary.host")).not_to be_nil
|
65
|
+
end
|
60
66
|
end
|
61
67
|
|
62
68
|
describe '#parse_hosts_string' do
|
63
|
-
|
64
69
|
it 'will return a #new_host_options hash if given no arguments' do
|
65
70
|
host_options = parser.parse_hosts_string
|
66
|
-
expect(
|
71
|
+
expect(host_options).to be === parser.new_host_options
|
67
72
|
end
|
68
73
|
|
69
74
|
it 'passes a process_yaml call through to #merge_hosts_yaml' do
|
70
75
|
yaml_string = 'not actually yaml, but that wont matter'
|
71
76
|
expect(described_class).to receive(:process_yaml).with(yaml_string, instance_of(Binding))
|
72
77
|
|
73
|
-
parser.parse_hosts_string(
|
78
|
+
parser.parse_hosts_string(yaml_string)
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
@@ -79,29 +84,29 @@ module Beaker
|
|
79
84
|
host_options = {}
|
80
85
|
yield_to_merge = { :pants => 'truth to the face' }
|
81
86
|
block_count = 0
|
82
|
-
answer = parser.merge_hosts_yaml(
|
87
|
+
answer = parser.merge_hosts_yaml(host_options, 'err_msg') do
|
83
88
|
block_count += 1
|
84
89
|
yield_to_merge
|
85
|
-
|
90
|
+
end
|
86
91
|
|
87
|
-
expect(
|
88
|
-
expect(
|
92
|
+
expect(block_count).to be === 1
|
93
|
+
expect(answer).to be === host_options.merge(yield_to_merge)
|
89
94
|
end
|
90
95
|
|
91
96
|
class MockSyntaxError < Psych::SyntaxError
|
92
97
|
def initialize
|
93
|
-
super(
|
98
|
+
super('', 0, 0, 0, '', '')
|
94
99
|
end
|
95
100
|
end
|
96
101
|
|
97
102
|
it 'raises an ArgumentError if can\'t process YAML' do
|
98
103
|
# allow( parser ).to receive( :merge_hosts_yaml )
|
99
104
|
err_value = 'err_msg8797'
|
100
|
-
expect
|
101
|
-
parser.merge_hosts_yaml(
|
105
|
+
expect do
|
106
|
+
parser.merge_hosts_yaml({}, err_value) do
|
102
107
|
raise MockSyntaxError
|
103
|
-
|
104
|
-
|
108
|
+
end
|
109
|
+
end.to raise_error(ArgumentError, /#{err_value}/)
|
105
110
|
end
|
106
111
|
end
|
107
112
|
|
@@ -109,13 +114,13 @@ module Beaker
|
|
109
114
|
it 'adds a roles array to a host if not present' do
|
110
115
|
host_options = { 'HOSTS' => {
|
111
116
|
'host1' => {},
|
112
|
-
'host2' => {}
|
113
|
-
}}
|
117
|
+
'host2' => {},
|
118
|
+
} }
|
114
119
|
|
115
|
-
parser.fix_roles_array(
|
120
|
+
parser.fix_roles_array(host_options)
|
116
121
|
|
117
|
-
host_options['HOSTS'].each do |
|
118
|
-
expect(
|
122
|
+
host_options['HOSTS'].each do |_host_name, host_hash|
|
123
|
+
expect(host_hash['roles']).to be === []
|
119
124
|
end
|
120
125
|
end
|
121
126
|
end
|
@@ -3,21 +3,18 @@ require "spec_helper"
|
|
3
3
|
module Beaker
|
4
4
|
module Options
|
5
5
|
describe OptionsFileParser do
|
6
|
-
|
7
|
-
let(:
|
8
|
-
let(:simple_opts) {File.join(File.expand_path(File.dirname(__FILE__)), "data", "opts.txt")}
|
6
|
+
let(:parser) { described_class }
|
7
|
+
let(:simple_opts) { File.join(__dir__, "data", "opts.txt") }
|
9
8
|
|
10
9
|
it "can correctly read options from a file" do
|
11
10
|
FakeFS.deactivate!
|
12
|
-
expect(parser.parse_options_file(simple_opts)).to be === {:debug=>true, :tests=>"test.rb", :pre_suite=>["pre-suite.rb"], :post_suite=>"post_suite1.rb,post_suite2.rb"}
|
11
|
+
expect(parser.parse_options_file(simple_opts)).to be === { :debug => true, :tests => "test.rb", :pre_suite => ["pre-suite.rb"], :post_suite => "post_suite1.rb,post_suite2.rb" }
|
13
12
|
end
|
14
13
|
|
15
14
|
it "raises an error on no file found" do
|
16
15
|
FakeFS.deactivate!
|
17
|
-
expect{parser.parse_options_file("not a valid path")}.to raise_error(ArgumentError)
|
16
|
+
expect { parser.parse_options_file("not a valid path") }.to raise_error(ArgumentError)
|
18
17
|
end
|
19
|
-
|
20
|
-
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -3,37 +3,35 @@ require "spec_helper"
|
|
3
3
|
module Beaker
|
4
4
|
module Options
|
5
5
|
describe OptionsHash do
|
6
|
-
let(:options)
|
7
|
-
|
6
|
+
let(:options) { described_class.new }
|
8
7
|
|
9
8
|
it "supports is_pe?, defaults to pe" do
|
10
|
-
expect(options
|
9
|
+
expect(options).to be_is_pe
|
11
10
|
end
|
12
11
|
|
13
12
|
it "supports is_pe?, respects :type == foss" do
|
14
13
|
options[:type] = 'foss'
|
15
|
-
expect(options
|
14
|
+
expect(options).not_to be_is_pe
|
16
15
|
end
|
17
16
|
|
18
17
|
describe '#get_type' do
|
19
|
-
let(:options) {
|
18
|
+
let(:options) { described_class.new }
|
20
19
|
|
21
20
|
it 'returns pe as expected in the normal case' do
|
22
|
-
newhash = options.merge({:type => 'pe'})
|
21
|
+
newhash = options.merge({ :type => 'pe' })
|
23
22
|
expect(newhash.get_type).to be === :pe
|
24
23
|
end
|
25
24
|
|
26
25
|
it 'returns foss as expected in the normal case' do
|
27
|
-
newhash = options.merge({:type => 'foss'})
|
26
|
+
newhash = options.merge({ :type => 'foss' })
|
28
27
|
expect(newhash.get_type).to be === :foss
|
29
28
|
end
|
30
29
|
|
31
30
|
it 'returns foss as the default' do
|
32
|
-
newhash = options.merge({:type => 'git'})
|
31
|
+
newhash = options.merge({ :type => 'git' })
|
33
32
|
expect(newhash.get_type).to be === :foss
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|