Sha256: c66af7122ae321abfab84f95c6756bdfc0aae1d705ebf8da4c1c0bd1ca74853c

Contents?: true

Size: 1004 Bytes

Versions: 7

Compression:

Stored size: 1004 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

7 entries across 7 versions & 1 rubygems

Version Path
generator-spec-0.4.7 spec/generator_spec/generators/model_generator_spec.rb
generator-spec-0.4.5 spec/generator_spec/model_generator_spec.rb
generator-spec-0.4.4 spec/generator_spec/model_generator_spec.rb
generator-spec-0.4.3 spec/rspec_for_generators/model_generator_spec.rb
generator-spec-0.4.2 spec/rspec_for_generators/model_generator_spec.rb
generator-spec-0.4.1 spec/rspec_for_generators/model_generator_spec.rb
generator-spec-0.4.0 spec/rspec_for_generators/model_generator_spec.rb