Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make schema directory if it doesn't exist #57

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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