Sha256: 1829ff39d74d62f1e3428ff8ab0ecf306d1692d29b15dc5ed2c83f2ae7aa7896

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require_generator :model

describe 'model_generator' do
  include RSpec::Rails::Orm::ActiveRecord
  
  before :each do              
    setup_generator 'model_generator' do
      tests ModelGenerator
    end    
    remove_model 'account'    
  end

  after :each do              
    remove_model 'account'    
  end
    
  it "should not work without an Account model file" do            
    with_generator do |g|   
      name = 'account'
      g.run_generator [name]
      g.should_not generate_file name, :model
    end
  end

  it "should decorate an existing Account model file with include Canable:Ables" do            
    with_generator do |g|  
      name = 'account'
      create_model name     
      g.run_generator [name]
      g.should generate_model name do |content|
        content.should have_class name do |klass|
          klass.should include_module 'Canable::Ables'
        end
      end
    end
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
generator-spec-0.5.0 spec/generator_spec/generators/model_generator_spec.rb
generator-spec-0.4.8 spec/generator_spec/generators/model_generator_spec.rb