Sha256: bea60b895cdaf8a309905cb2615fcf5c48f6c9cc17f4e2bc9517a8bad028c708

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

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

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

  after :each do              
    remove_model 'account'    
  end
    
  it "should not work without an Account model file" do            
    RSpec::Generator.with_generator do |g|   
      name = 'account'
      g.run_generator %w{account}
      g.should_not generate_file name, :model
    end
  end

  it "should decorate an existing Account model file with include Canable:Ables" do            
    RSpec::Generator.with_generator do |g|  
      name = 'account'
      create_model name     
      g.run_generator %w{account}
      g.should generate_file name, :model do |content|
        content.should have_class name do |klass|
          klass.should include_module 'Canable::Ables'
        end
      end
    end
  end
end



Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
generator-spec-0.3.5 spec/rspec_for_generators/model_generator_spec.rb
generator-spec-0.3.4 spec/rspec_for_generators/model_generator_spec.rb
generator-spec-0.3.3 spec/rspec_for_generators/rspec_for_generators_spec.rb
rspec_for_generators-0.3.1 spec/rspec_for_generators/rspec_for_generators_spec.rb