spec/lib/rspec/hive/configuration_spec.rb in rspec-hive-0.1.0 vs spec/lib/rspec/hive/configuration_spec.rb in rspec-hive-0.2.0
- old
+ new
@@ -1,9 +1,9 @@
require 'spec_helper'
require 'tempfile'
-describe RSpec::Hive::Configuration do
+RSpec.describe RSpec::Hive::Configuration do
RSpec.shared_examples('config') do
its(:host) do
is_expected.to eq(expected_host)
end
@@ -51,36 +51,39 @@
'mapred.child.java.opts' => expected_java_opts}
end
context 'when no configuration file is provided' do
let(:expected_port) { 10000 }
+ let!(:original_host_os) { RbConfig::CONFIG['host_os'] }
before { allow(Dir).to receive(:mktmpdir) { mock_tmpdir } }
- subject { described_class.new }
-
context 'when on Mac' do
let(:mock_tmpdir) { '/Users/Shared/test/' }
let(:expected_host) { '192.168.99.100' }
let(:expected_host_shared_directory_path) { '/Users/Shared/test/spec-tmp-files' }
before do
- allow_any_instance_of(described_class).to receive(:mac?) { true }
+ RbConfig::CONFIG['host_os'] = 'mac os'
end
+ after { RbConfig::CONFIG['host_os'] = original_host_os }
+
include_examples('config')
end
context 'when on Linux' do
let(:mock_tmpdir) { '/tmp/test/' }
let(:expected_host) { '127.0.0.1' }
let(:expected_host_shared_directory_path) { '/tmp/test/spec-tmp-files' }
before do
- allow_any_instance_of(described_class).to receive(:mac?) { false }
+ RbConfig::CONFIG['host_os'] = 'linux'
end
+ after { RbConfig::CONFIG['host_os'] = original_host_os }
+
include_examples('config')
end
end
context 'when there is a configuration file' do
@@ -134,10 +137,10 @@
subject { described_class.new(path_to_config_file) }
include_examples('config')
end
- context 'where there are some parametres required and optional' do
+ context 'where there are some parameters required and optional' do
let(:yaml_hash) do
{
'hive' =>
{
'host' => '127.0.0.2',