spec/lib/generators/relation_generator_spec.rb in rom-rails-0.9.0 vs spec/lib/generators/relation_generator_spec.rb in rom-rails-1.0.0.beta1

- old
+ new

@@ -1,10 +1,8 @@ -require 'spec_helper' - require 'generators/rom/relation_generator' -describe ROM::Generators::RelationGenerator, type: :generator do +RSpec.describe ROM::Generators::RelationGenerator, type: :generator do destination File.expand_path('../../../../tmp', __FILE__) before(:each) do prepare_destination end @@ -17,16 +15,14 @@ directory 'app' do directory 'relations' do file 'users_relation.rb' do contains <<-CONTENT.strip_heredoc class UsersRelation < ROM::Relation[:#{default_adapter}] - # gateway :default + gateway :default - dataset :users + schema(:users, infer: true) - register_as :users - # define your methods here ie: # # def all # select(:id, :name).order(:id) # end @@ -54,8 +50,8 @@ specify "with given registration" do run_generator ['users', '--register=profiles'] relation = File.read(File.join(destination_root, 'app', 'relations', 'users_relation.rb')) - expect(relation).to include("register_as :profiles") + expect(relation).to match(/schema.*as: :profiles/) end end