Sha256: 0687d0e33c7ebdd483a5a63af239e2545a02d2187426c093b0601ef98de240e7

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require_generator :model

describe 'model_generator' do
  use_orm :mongoid

  before do
    setup_generator :model do
      tests ModelGenerator
    end    
  end
  
  before :each do              
    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|   
      g.run_generator :account.args
      g.should_not generate_model :account
    end
  end

  it "should decorate an existing Account model file with include Canable:Ables" do            
    create_model :account
       
    with_generator do |g|        
      g.run_generator :account.args
      g.should generate_artifact :account, :model
            
      g.should generate_model :account do |content|
        content.should include_module 'Canable::Ables'
      end
      
      g.should_not generate_model :user
      g.should_not generate_controller :user            
    end
  end
  
  it "should not have generated other things!" do            
    with_generator do |g|        
      g.should_not generate_model :user
      g.should_not generate_controller :user      
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
generator-spec-0.7.4 spec/generator_spec/matchers/generate_artifact_spec.rb
generator-spec-0.7.2 spec/generator_spec/matchers/generate_artifact_spec.rb
generator-spec-0.7.1 spec/generator_spec/matchers/generate_artifact_spec.rb
generator-spec-0.7.0 spec/generator_spec/matchers/generate_artifact_spec.rb
generator-spec-0.6.6 spec/generator_spec/matchers/generate_artifact_spec.rb
generator-spec-0.6.5 spec/generator_spec/matchers/generate_artifact_spec.rb