Sha256: 1a0881a073ae677f35bf91520c99d3b09ba008e8127350dc756f7a535af1372f

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  # config.filter_run :focus

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'

  config.before do
    Kernel.stub(:spawn).and_raise("Spawning is not permitted in specs.  Please change your spec to use expectations/stubs.")
    # by default, have it say it is running Red Hat linux
    stub_distro
  end

  config.after do
    clear_caches

    # reset the distro, tested in various placed & used extensively
    LinuxAdmin::Distros.instance_variable_set(:@local, nil)
  end
end

begin
  require 'coveralls'
  Coveralls.wear!
rescue LoadError
end

require 'linux_admin'

def etc_issue_contains(contents)
  LinuxAdmin::EtcIssue.instance.send(:refresh)
  allow(File).to receive(:exists?).with('/etc/issue').at_least(:once).and_return(true)
  allow(File).to receive(:read).with('/etc/issue').at_least(:once).and_return(contents)
end

def stub_distro(distro = LinuxAdmin::Distros.rhel)
  # simply alias test distro to redhat distro for time being
  LinuxAdmin::Distros.stub(:local => distro)
end

def data_file_path(to)
  File.expand_path(to, File.join(File.dirname(__FILE__), "data"))
end

def sample_output(to)
  File.read(data_file_path(to))
end

def clear_caches
  LinuxAdmin::RegistrationSystem.instance_variable_set(:@registration_type, nil)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
linux_admin-0.9.1 spec/spec_helper.rb
linux_admin-0.9.0 spec/spec_helper.rb