Created
March 7, 2025 12:11
-
-
Save bschonec/6ecc74de6c4268535cf6f4e2221cb502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| require 'spec_helper' | |
| require 'facter' | |
| require 'facter/application' | |
| describe 'test Oracle region fact' do | |
| subject { Facter.fact(:region) } | |
| ips = { | |
| '10.105.64.1' => { 'region' => 'chicago' }, | |
| '10.105.128.1' => { 'region' => 'ashburn' }, | |
| '1.2.3.4' => { 'region' => 'other' }, | |
| } | |
| context 'checking regions locations' do | |
| -- ips.each do |ip, region| | |
| context "checking region #{region}" do | |
| before(:each) do | |
| # perform any action that should be run before every test | |
| Facter.clear | |
| allow(Facter.fact(:networking.ip)).to receive(:value).and_return('#{ip}') | |
| end | |
| it "uses the built-in facts to return the application hash for #{region}" do | |
| expect(Facter.fact(:region).value).to eq('chicago') | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment