Created
March 7, 2025 17:49
-
-
Save bschonec/3da5ebb3e965df5d5c18a82f337e22aa to your computer and use it in GitHub Desktop.
Spec Test
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' }, | |
| '10.105.222.1' => { 'region' => 'oracle' }, | |
| '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)).to receive(:value).and_return(ip) | |
| end | |
| it "uses the built-in facts #{ip} to return the application hash for #{region['region']}" do | |
| expect(Facter.fact(:region).value).to eq('chicago') | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.