features/example.feature in terrestrial-0.1.1 vs features/example.feature in terrestrial-0.3.0

- old
+ new

@@ -46,32 +46,32 @@ host: ENV.fetch("PGHOST"), user: ENV.fetch("PGUSER"), database: ENV.fetch("PGDATABASE"), ) """ - And the associations are defined in the mapper configuration + And the associations are defined in the configuration """ - MAPPINGS_CONFIG = Terrestrial.config(DB) - .setup_mapping(:users) { |users| - users.class(User) - users.has_many(:posts, foreign_key: :author_id) - } - .setup_mapping(:posts) { |posts| - posts.class(Post) - posts.belongs_to(:author, mapping_name: :users) - posts.has_many_through(:categories) - } - .setup_mapping(:categories) { |categories| - categories.class(Category) - categories.has_many_through(:posts) - } + MAPPINGS = Terrestrial.config(DB) + .setup_mapping(:users) { |users| + users.class(User) + users.has_many(:posts, foreign_key: :author_id) + } + .setup_mapping(:posts) { |posts| + posts.class(Post) + posts.belongs_to(:author, mapping_name: :users) + posts.has_many_through(:categories) + } + .setup_mapping(:categories) { |categories| + categories.class(Category) + categories.has_many_through(:posts) + } """ - And a mapper is instantiated + And a object store is instantiated """ - MAPPERS = Terrestrial.mappers( + OBJECT_STORE = Terrestrial.object_store( datastore: DB, - mappings: MAPPINGS_CONFIG, + mappings: MAPPINGS, ) """ When a new graph of objects are created """ user = User.new( @@ -91,30 +91,30 @@ [], ) """ And the new graph is saved """ - MAPPERS[:users].save(user) + OBJECT_STORE[:users].save(user) """ And the following query is executed """ - user = MAPPERS[:users].where(id: "2f0f791c-47cf-4a00-8676-e582075bcd65").first + user = OBJECT_STORE[:users].where(id: "2f0f791c-47cf-4a00-8676-e582075bcd65").first """ Then the persisted user object is returned with lazy associations """ #<struct User id="2f0f791c-47cf-4a00-8676-e582075bcd65", first_name="Hansel", last_name="Trickett", email="hansel@tricketts.org", - posts=#<Terrestrial::CollectionMutabilityProxy:7fa4817aa148 - >> + posts=#<Terrestrial::CollectionMutabilityProxy:0x007f9d8aa93bf0> + > """ And the user's posts will be loaded once the association proxy receives an Enumerable message """ [#<struct Post id="9b75fe2b-d694-4b90-9137-6201d426dda2", - author=#<Terrestrial::LazyObjectProxy:7fec5ac2a5f8 key_fields={:id=>"2f0f791c-47cf-4a00-8676-e582075bcd65"} lazy_object=nil>, + author=#<Terrestrial::LazyObjectProxy:0x007f81b2b86d30 key_fields={:id=>"2f0f791c-47cf-4a00-8676-e582075bcd65"} lazy_object=nil>, subject="Things that I like", body="I like fish and scratching", created_at=2015-10-03 21:00:00 UTC, - categories=#<Terrestrial::CollectionMutabilityProxy:7fec5ac296f8 - >>] + categories=#<Terrestrial::CollectionMutabilityProxy:0x007f9d8ad88d38> + >] """