Sha256: 7f82657f816d2a617973dfdada1be63353a2061327f87730dd50a06a49986a78
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe SchemaBuilder::Writer do context 'in general' do before :each do @writer = SchemaBuilder::Writer.new end it 'should get model_path' do @writer.model_path.should == "#{Dir.pwd}/app/models/**/*.rb" end it 'should set model_path' do path = 'some/model-folder/*.*.rb' @writer.model_path = path @writer.model_path.should == path end it 'should get models' do @writer.models.should include(User) end end context 'file writing' do before :each do @writer = SchemaBuilder::Writer.new @writer.out_path = test_out_path @writer.model_path = File.join( File.expand_path( __FILE__), '../fixtures/*.rb') @writer.write @file_path = File.join(test_out_path, 'user.json') end it 'should write file' do File.exist?( @file_path ).should be File.delete @file_path end it 'should write valid json' do hsh = JSON.parse( File.read @file_path) hsh['type'].should == 'object' hsh['title'].should == 'User' field_names = hsh['properties'].keys field_names.should include 'id', 'number', 'birthday', 'is_admin', 'notes' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json_schema_builder-0.0.6 | spec/schema_builder/writer_spec.rb |
json_schema_builder-0.0.5 | spec/schema_builder/writer_spec.rb |
json_schema_builder-0.0.4 | spec/schema_builder/writer_spec.rb |