fauxhai 4.0.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +14 -0
- data/lib/fauxhai/mocker.rb +6 -2
- data/lib/fauxhai/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97f791d89ebee00fc2f187f079adca999e35a89
|
4
|
+
data.tar.gz: 298293b4db5ea8f21c79ddcfd541d4a7b72ef21a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0127c1d004a5b2604438cfb5112b0eae809d5f3ca668e76d64a9d9ce06f0b48eeb03b0c7c333b9627ba372e8f83a5f9227c0b3c84032ca4ed4817ac4031b8d3c
|
7
|
+
data.tar.gz: 20977fc27869f251553f4899bc13a0f93f512d45b2ab79a5a39f2275007c5ef6fd8eec990f0a7c388118396a5108b7a24bd25f64a3e517547ff1f624ea07af54
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -154,6 +154,20 @@ describe 'awesome_cookbook::default' do
|
|
154
154
|
end
|
155
155
|
```
|
156
156
|
|
157
|
+
### Disabling Fetching from Github
|
158
|
+
|
159
|
+
On environments that does not have access to the internet, you can disable fetching fauxhai data from github as follow:
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
require 'chefspec'
|
163
|
+
|
164
|
+
describe 'awesome_cookbook::default' do
|
165
|
+
before do
|
166
|
+
Fauxhai.mock(platform: 'ubuntu', version: '12.04', github_fetching: false)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
157
171
|
## Testing Multiple Versions
|
158
172
|
|
159
173
|
It's a common use case to test multiple version of the same operating system. Here's a simple example to get your started. This is more rspec-related that fauxhai related, but here ya go:
|
data/lib/fauxhai/mocker.rb
CHANGED
@@ -23,8 +23,10 @@ module Fauxhai
|
|
23
23
|
# the version of the platform to mock
|
24
24
|
# @option options [String] :path
|
25
25
|
# the path to a local JSON file
|
26
|
+
# @option options [Bool] :github_fetching
|
27
|
+
# whether to try loading from Github
|
26
28
|
def initialize(options = {}, &override_attributes)
|
27
|
-
@options = options
|
29
|
+
@options = { github_fetching: true }.merge(options)
|
28
30
|
|
29
31
|
@data = fauxhai_data
|
30
32
|
yield(@data) if block_given?
|
@@ -58,7 +60,7 @@ module Fauxhai
|
|
58
60
|
|
59
61
|
if File.exist?(filepath)
|
60
62
|
JSON.parse( File.read(filepath) )
|
61
|
-
elsif
|
63
|
+
elsif !@options[:github_fetching]
|
62
64
|
# Try loading from github (in case someone submitted a PR with a new file, but we haven't
|
63
65
|
# yet updated the gem version). Cache the response locally so it's faster next time.
|
64
66
|
begin
|
@@ -77,6 +79,8 @@ module Fauxhai
|
|
77
79
|
else
|
78
80
|
raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' in any of the sources! #{PLATFORM_LIST_MESSAGE}")
|
79
81
|
end
|
82
|
+
else
|
83
|
+
raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' in any of the sources!")
|
80
84
|
end
|
81
85
|
end.call
|
82
86
|
end
|
data/lib/fauxhai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fauxhai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
255
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.6.
|
256
|
+
rubygems_version: 2.6.11
|
257
257
|
signing_key:
|
258
258
|
specification_version: 4
|
259
259
|
summary: Fauxhai provides an easy way to mock out your ohai data for testing with
|