Sha256: 7a0a6d858b4755ddee4af7517c62230f29cb7461314d39ec0f115899aee4c575

Contents?: true

Size: 1.21 KB

Versions: 81

Compression:

Stored size: 1.21 KB

Contents

require 'rails_generator/generators/components/model/model_generator'
require File.dirname(__FILE__) + '/../rspec_default_values'

class RspecModelGenerator < ModelGenerator

  def manifest

    record do |m|
      # Check for class naming collisions.
      m.class_collisions class_path, class_name

      # Model, spec, and fixture directories.
      m.directory File.join('app/models', class_path)
      m.directory File.join('spec/models', class_path)
      unless options[:skip_fixture]
        m.directory File.join('spec/fixtures', class_path)
      end

      # Model class, spec and fixtures.
      m.template 'model:model.rb',      File.join('app/models', class_path, "#{file_name}.rb")
      m.template 'model_spec.rb',       File.join('spec/models', class_path, "#{file_name}_spec.rb")
      unless options[:skip_fixture]
        m.template 'model:fixtures.yml',  File.join('spec/fixtures', "#{table_name}.yml")
      end

      unless options[:skip_migration]
        m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
          :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
        }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
      end

    end
  end

end

Version data entries

81 entries across 81 versions & 13 rubygems

Version Path
rspec-rails-1.3.1 generators/rspec_model/rspec_model_generator.rb
rspec-rails-1.3.0 generators/rspec_model/rspec_model_generator.rb
hubbub-0.0.11 lib/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
hubbub-0.0.10 lib/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
hubbub-0.0.9 lib/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
hubbub-0.0.8 lib/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
hubbub-0.0.6 lib/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb
rspec-rails-1.2.9 generators/rspec_model/rspec_model_generator.rb
rspec-rails-1.2.7 generators/rspec_model/rspec_model_generator.rb
rspec-rails-1.2.7.1 generators/rspec_model/rspec_model_generator.rb
pictrails-0.5.0 vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
rspec-rails-1.1.10 generators/rspec_model/rspec_model_generator.rb