Sha256: efbc41d265b862ae39a23c8e5314c814a88fb3889132cfec927ad959b5ecb4fa
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' require 'generators/rom/relation_generator' describe ROM::Generators::RelationGenerator, type: :generator do destination File.expand_path('../../../../tmp', __FILE__) before(:each) do prepare_destination end specify do run_generator ['users'] default_adapter = ROM.adapters.keys.first expect(destination_root).to have_structure { directory 'app' do directory 'relations' do file 'users_relation.rb' do contains <<-CONTENT.strip_heredoc class UsersRelation < ROM::Relation[:#{default_adapter}] dataset :users # define your methods here ie: # # def all # select(:id, :name).order(:id) # end end CONTENT end end end } end specify "with given adapter" do run_generator ['users', '--adapter=memory'] relation = File.read(File.join(destination_root, 'app', 'relations', 'users_relation.rb')) expect(relation).to include("class UsersRelation < ROM::Relation[:memory]") end end
Version data entries
4 entries across 4 versions & 1 rubygems