Sha256: 7ca090f479b04aa24cab39fb5a6d59612af86d8e77b8a8c43819b8212f5c8614

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

require 'generators/rom/mapper_generator'

describe ROM::Generators::MapperGenerator do
  destination File.expand_path('../../../../tmp', __FILE__)

  before(:all) do
    prepare_destination
    run_generator ['users']
    run_generator ['app_user']
  end

  specify do
    expect(destination_root).to have_structure {
      directory 'app' do
        directory 'mappers' do
          file 'user_mapper.rb' do
            contains <<-CONTENT.strip_heredoc
              class UserMapper < ROM::Mapper
                relation :users

                register_as :user

                # specify model and attributes ie
                #
                # model User
                #
                # attribute :name
                # attribute :email
              end
            CONTENT
          end

          file 'app_user_mapper.rb' do
            contains <<-CONTENT.strip_heredoc
              class AppUserMapper < ROM::Mapper
                relation :app_users

                register_as :app_user

                # specify model and attributes ie
                #
                # model AppUser
                #
                # attribute :name
                # attribute :email
              end
            CONTENT
          end
        end
      end
    }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rom-rails-0.9.0 spec/lib/generators/mapper_generator_spec.rb
rom-rails-0.9.0.beta1 spec/lib/generators/mapper_generator_spec.rb
rom-rails-0.8.0 spec/lib/generators/mapper_generator_spec.rb
rom-rails-0.7.0 spec/lib/generators/mapper_generator_spec.rb