Skip to content

Commit 6caa0be

Browse files
author
Kevin Paulisse
committed
Add fixtures with escaped facts
1 parent cb95f1f commit 6caa0be

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"apt_update_last_success":1458162123,
3+
"architecture":"amd64",
4+
"datacenter":"xyz",
5+
"fqdn":"rspec-node.xyz.github.net",
6+
"math":"1+2=3",
7+
"percent":"25%20=5",
8+
"_timestamp":"2014-12-02 14:56:20 -0600"
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#--- !ruby/object:Puppet::Node::Facts
2+
name: rspec-node.xyz.github.net
3+
values:
4+
apt_update_last_success: 1458162123
5+
architecture: amd64
6+
datacenter: xyz
7+
fqdn: rspec-node.xyz.github.net
8+
math: "1+2=3"
9+
percent: "25%20=5"
10+
"_timestamp": 2014-12-02 12:56:20.865795 -08:00
11+
expiration: 2014-12-02 13:11:20.521667 -08:00

spec/octocatalog-diff/tests/catalog/puppetmaster_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
node: 'foo',
1212
branch: 'foobranch',
1313
puppet_master: 'fake-puppetmaster.non-existent-domain.com',
14-
fact_file: OctocatalogDiff::Spec.fixture_path('facts/facts.yaml')
14+
fact_file: OctocatalogDiff::Spec.fixture_path('facts/facts_esc.yaml')
1515
}
1616
end
1717

@@ -99,7 +99,7 @@
9999
end
100100

101101
it 'should post the correct facts to HTTParty' do
102-
answer = JSON.parse(File.read(OctocatalogDiff::Spec.fixture_path('facts/facts.json')))
102+
answer = JSON.parse(File.read(OctocatalogDiff::Spec.fixture_path('facts/facts_esc.json')))
103103
answer.delete('_timestamp')
104104
result = JSON.parse(@post_data['facts'])['values']
105105
expect(result).to eq(answer)
@@ -118,8 +118,8 @@
118118
it 'should log correctly' do
119119
logs = @logger_str.string
120120
expect(logs).to match(/Start retrieving facts for foo from OctocatalogDiff::Catalog::PuppetMaster/)
121-
expect(logs).to match(%r{Retrieving facts from.*fixtures/facts/facts.yaml})
122-
expect(logs).to match(%r{Retrieving facts from.*fixtures/facts/facts.yaml})
121+
expect(logs).to match(%r{Retrieving facts from.*fixtures/facts/facts_esc.yaml})
122+
expect(logs).to match(%r{Retrieving facts from.*fixtures/facts/facts_esc.yaml})
123123

124124
answer = Regexp.new("Retrieve catalog from #{api_url[api_version]} environment foobranch")
125125
expect(logs).to match(answer)

0 commit comments

Comments
 (0)