Sha256: 61a3aae9312d7c040f765cebd154c59d1e43fa69451dd55e19ceca7cb180d7da

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

require 'helper'

class TestMongoMapperGenerators < GeneratorTestCase
  
  context "running the mongo_initializer generator" do
    setup do
      run_generator('mongo_initializer')
    end
    
    should_generate_file 'config/initializers/mongomapper.rb'
    should_generate_file 'config/database.yml'
  end
  
  context "running the mongo_model generator" do
    
    context "with factories" do    
      setup do
        run_generator('mongo_model', %w(Person name:string email:string many:addresses index:email belongs_to:corporation))
      end
    
      should_generate_file 'app/models/person.rb'
      should_generate_file 'test/unit/person_test.rb'
      should_generate_file 'test/factories/people.rb'
    end
    
    context "without factories" do
      setup do
        run_generator('mongo_model', %w(Person name:string email:string many:addresses index:email belongs_to:corporation --skip-factories))
      end
    
      should_generate_file 'app/models/person.rb'
      should_generate_file 'test/unit/person_test.rb'
      should_not_generate_file 'test/factories/people.rb'
    end
  end

  context "running the embedded_model generator" do
    setup do
      run_generator('embedded_model', %w(Address street:string state:integer city:string zip:string))
    end
    
    should_generate_file 'app/models/address.rb'
    should_generate_file 'test/unit/address_test.rb'
    should_generate_file 'test/factories/addresses.rb'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo_mapper_generators-1.0.3 test/test_mongo_mapper_generators.rb
mongo_mapper_generators-1.0.2 test/test_mongo_mapper_generators.rb
mongo_mapper_generators-1.0.1 test/test_mongo_mapper_generators.rb
mongo_mapper_generators-1.0.0 test/test_mongo_mapper_generators.rb