Closed fuero closed 6 years ago
Yeah that's definitely a bug. Investigating...
Hmm so this works for me
require 'onceover/controlrepo'
Onceover::Controlrepo.facts
However you are right about the facts
method returning all facts. This is because a Controlrepo
object knows nothing about your config, it just represents the state of your controlrepo, ignoring onceover. (To a degree)
If you want the facts that are referenced you will need to create a Onceover::TestConfig
object. You can do this by:
require 'onceover/controlrepo'
require 'onceover/testconfig'
repo = Onceover::Controlrepo.new
config = Onceover::TestConfig.new(repo.onceover_yaml)
config.nodes.each do |node| # List of node objects
node.fact_set # The set of facts
end
Hi,
I'm trying to use traditional rspec tests with factsets. When dropping in traditional test files, onceover runs them, but accessing the facts doesn't work as documented:
Using
Onceover::Controlrepo.facts.each do |facts|
fails withUsing
Onceover::Controlrepo.new,facts.each do |facts|
does work, but seems to ignoreonceover.yaml
and is thus running the test on all factsets available, not just the ones I set up for this repo.Any ideas?