Skip to content

Commit

Permalink
Make schema directory if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Richmond committed Jan 8, 2019
1 parent b18f312 commit fa49eb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/graphiti/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def self.generate!(resources = nil)
errors = Graphiti::SchemaDiff.new(old, schema).compare
return errors if errors.any?
end
FileUtils.mkdir_p(Graphiti.config.schema_path.gsub('/schema.json', ''))
File.write(Graphiti.config.schema_path, JSON.pretty_generate(schema))
[]
end
Expand Down
1 change: 1 addition & 0 deletions spec/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ def self.name;'Schema::CondoResource';end
end

before do
allow(FileUtils).to receive(:mkdir_p).with('/schema/path')
allow(File).to receive(:write)
allow(File).to receive(:read).with('/schema/path/schema.json') { old_schema }
allow(File).to receive(:exists?)
Expand Down

0 comments on commit fa49eb3

Please # to comment.