Skip to content

Commit 231143e

Browse files
authored
Merge pull request #1 from github/kpaulisse-travis
Travis CI integration
2 parents 88e4a98 + a4025cc commit 231143e

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# octofacts!
2+
3+
language: ruby
4+
install: true
5+
script: "script/cibuild"
6+
7+
matrix:
8+
include:
9+
- rvm: 2.4
10+
- rvm: 2.3.2
11+
- rvm: 2.2.3
12+
- rvm: 2.1

lib/octofacts/facts.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def method_missing(name, *args, &block)
8181
return self
8282
end
8383

84-
if facts.respond_to?(name)
84+
if facts.respond_to?(name, false)
8585
if args[0].is_a?(String) || args[0].is_a?(Symbol)
8686
args[0] = string_or_symbolized_key(args[0])
8787
end
@@ -91,11 +91,11 @@ def method_missing(name, *args, &block)
9191
raise NameError, "Unknown method '#{name}' in #{self.class}"
9292
end
9393

94-
def respond_to?(method)
94+
def respond_to?(method, include_all = false)
9595
camelized_name = (method.to_s).split("_").collect(&:capitalize).join
9696
super || Kernel.const_get("Octofacts::Manipulators::#{camelized_name}")
9797
rescue NameError
98-
return facts.respond_to?(method)
98+
return facts.respond_to?(method, include_all)
9999
end
100100

101101
private

spec/octofacts_updater/fixture_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@
177177
obj.write_file(outfile)
178178

179179
expect(File.file?(outfile)).to eq(true)
180-
expect(File.read(outfile)).to eq(File.read(fixture_file))
180+
181+
# Different ruby versions or environments can cause the YAML generation to be slightly different.
182+
# For example we ran into this diff:
183+
# - uuid: 09809809-0980-0980-0980-098098098098
184+
# + uuid: '09809809-0980-0980-0980-098098098098'
185+
# To avoid this parse the YAML and compare that instead.
186+
fixture_yaml = YAML.safe_load(File.read(fixture_file))
187+
generated_yaml = YAML.safe_load(File.read(outfile))
188+
expect(generated_yaml).to eq(fixture_yaml)
181189
end
182190
end
183191
end

0 commit comments

Comments
 (0)