Sha256: 9cb345510f177c542f0949dc0fcb4a7354b21f558126f468c1f75d62f5bca243
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/functional_spec_helper') describe 'Models From Tables generator' do before :all do silence_warnings { RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../../output/functional') } FileUtils.mkdir_p(RAILS_ROOT + '/app/models') LegacyData::Schema.stub!(:log) end after :all do Object.send(:remove_const, :RAILS_ROOT) end it 'should generate a posts model' do invoke_generator('models_from_tables', ["--table-name", "posts"], :create) File.read(RAILS_ROOT + '/app/models/post.rb').should == File.read(File.expand_path(File.dirname(__FILE__) + '/expected/post.rb')) end it 'should generate all models in database' do invoke_generator('models_from_tables', [], :create) File.read(RAILS_ROOT + '/app/models/post.rb').should == File.read(File.expand_path(File.dirname(__FILE__) + '/expected/post.rb')) File.read(RAILS_ROOT + '/app/models/comment.rb').should == File.read(File.expand_path(File.dirname(__FILE__) + '/expected/comment.rb')) end end
Version data entries
4 entries across 4 versions & 1 rubygems