Sha256: dca32bb60d754d7c28972ec5cc541bdf63be8d5cc27f2c1a9c49595551db7bfb

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'generators/rom/mapper_generator'

RSpec.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

6 entries across 6 versions & 1 rubygems

Version Path
rom-rails-1.1.1 spec/lib/generators/mapper_generator_spec.rb
rom-rails-1.1.0 spec/lib/generators/mapper_generator_spec.rb
rom-rails-1.0.1 spec/lib/generators/mapper_generator_spec.rb
rom-rails-1.0.0 spec/lib/generators/mapper_generator_spec.rb
rom-rails-1.0.0.rc1 spec/lib/generators/mapper_generator_spec.rb
rom-rails-1.0.0.beta1 spec/lib/generators/mapper_generator_spec.rb