puppet_spec_facts 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 913f0955401c3928fce555e37dc439051d80d152
4
- data.tar.gz: 90e913645b52b8630bfc69de8e5dd9b5acdb0ad4
3
+ metadata.gz: 4e204471ee4c0cc382e406cb561a6ebad319f804
4
+ data.tar.gz: c7342c6e4538c7f0c2e65f3db396a193a7b007c8
5
5
  SHA512:
6
- metadata.gz: 7709b857e8ec19996830c55c433b5411d97ea69259149c3fcc3d4e1eab9f89619e091cb645cf5ed51a1b785927e9c928f02147829ea01b77cb1ce10828e95c2e
7
- data.tar.gz: 76d9e737b719ae264c78976322242b919781e55584fc014ef8680c8520b189f8cbcfd7adb55dbe4b192a1bf05c6d4270736127fe03fe12c4c4f7e9fba4c53ab1
6
+ metadata.gz: 168d889a3c4b7af8eeafcec4d213bdb51a9abad1499548f658aefbe73a2bf65b65f2c240c61d1d3ccbd71de420e79efb66e187c6e97a5cdf42a4d3a4aee8dedd
7
+ data.tar.gz: 326176c8bc3b8c21aeb20e35ea8e96f22108d7806e71499c4d79748e60bceb02bc2b52657d8e354581f612787dee26fba4576496d7396fd613d5f9b736456f7f
data/README.md CHANGED
@@ -62,17 +62,22 @@ describe 'example' do
62
62
  end
63
63
  ```
64
64
 
65
- In the real world, you probably don't want to iterate through all of the platforms, so `puppet_spec_facts` allows you to query a subset based on facter facts:
65
+ In the real world, you probably don't want to iterate through all of the
66
+ platforms, so `puppet_spec_facts` allows you to query a subset based on
67
+ facter facts:
66
68
 
67
69
  ```ruby
68
70
  require 'spec_helper'
69
71
 
70
72
  describe 'example' do
71
73
  context 'all operating systems' do
72
- PuppetSpecFacts.facts_for_platform_by_fact(select_facts: {'lsbdistid' => 'CentOS',
73
- 'architecture' => 'x86_64',
74
- 'is_pe' => 'true',
75
- 'fact_style' => 'stringified'}) do |name, facthash|
74
+ PuppetSpecFacts.facts_for_platform_by_fact(
75
+ select_facts: {
76
+ 'lsbdistid' => 'CentOS',
77
+ 'architecture' => 'x86_64',
78
+ 'is_pe' => 'true',
79
+ 'fact_style' => 'stringified'
80
+ }) do |name, facthash|
76
81
  # This loads all fact sets for Puppet Enterprise on x86_64 CentOS with stringified-style facts
77
82
  describe "example class without any parameters on #{name}" do
78
83
  let(:params) {{ }}
@@ -84,3 +89,9 @@ describe 'example' do
84
89
  end
85
90
  end
86
91
  ```
92
+
93
+ In many cases, this will provide too many results. You can constrain the
94
+ results further by using the `select_facts` parameter to indicate the general
95
+ set, then the `unique_selector` parameter to only return one result for the
96
+ parameters specified in `unique_selector`. For example, you may wish to only get
97
+ one result per `operatingsystemrelease` fact, to avoid testing
@@ -54,8 +54,13 @@ module PuppetSpecFacts
54
54
  }
55
55
  end
56
56
 
57
- def self.facts_for_platform_by_name(platform)
58
- puppet_platforms[platform]
57
+ def self.facts_for_platform_by_name(platforms)
58
+ platforms = [platforms] if platforms.is_a?(String)
59
+ results = {}
60
+ platforms.each do |name|
61
+ results[:"#{name}"] = puppet_platforms[name]
62
+ end
63
+ results
59
64
  end
60
65
 
61
66
  def self.resave_all_facts
@@ -1,3 +1,3 @@
1
1
  module PuppetSpecFacts
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_spec_facts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Dreier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2014-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler