Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

DataMapper 0.10.0 (Next Branch)

myobie edited this page Aug 14, 2010 · 16 revisions

Synopsis

The purpose of this branch is fix DataMapper’s broken specs.

The goal is to spec only DataMapper’s public and semi-public API and achieve full spec coverage of all DataMapper code, without using any mocks.

Note: It is acceptable, and almost certainly probable, that the spec suite will have many failures while this project is ongoing. I have removed any requirement to have DO installed to run the specs, and set it up to use the in-memory adapter as the default spec adapter.

Guidelines

Must Read: Spec Writing Guide

The DataMapper API has been divided up into three categories: public, semi-public and private. Public includes anything that the end user interacts with. Semi-public is hidden from public view, and is provided primarily for plugins.

All public and semipublic API code must include specs and be documented using the YARD documentation format.

Anything that not part of the public and semipublic API should not be directly specced, since the public/semipublic specs should cover that code indirectly. Code that cannot be reached through public/semi-public specs should be considered part of a “dead code path” and removed.

Spec Helper Methods

There are some helper methods that define what adapters support different specs. The main helper method is #supported_by and takes a list of the supported adapters. If the specs are supported by all adapters, then supported_by :all should be used.

It is important to note that all specs should be wrapped by a supported_by method. This allows the spec runner to run all the specs on each supported adapter. For an example of how this should be used, see spec/public/resource_spec.rb

Shared Specs

We are making fairly heavy uses of shared specs between similar classes. For example, all the adapters should implement the same core API, and a shared spec is being created to fully exercise that API. The same goes for collections, one-to-many and many-to-many associations, which share mostly the same API, even though the implementations may differ.

It is important after writing a spec to look at what you’ve written can be used to test other similar classes.

TODO

If you wish to contribute to improving a specific class, please put your IRC handle below.

Public API

Class Doc/Spec Done(%) Status
DataMapper::Association dph dbussink 100 Complete
DataMapper::Association::ManyToMany dkubb 30 Started
DataMapper::Association::ManyToOne dbussink 100 Refactored Out
DataMapper::Association::OneToMany dkubb 90 Needs docs
DataMapper::Association::OneToOne aq1018 30 Started
DataMapper::Collection dkubb 90 NeedsExamples for each method
DataMapper::Model - 75 -
DataMapper::Resource dbussink 80 Needs YARD docs

Semi-Public API

Class Doc/Spec Done(%) Status
DataMapper::Adapters::InMemoryAdapter Rando 100 -
DataMapper::Adapters::YamlAdapterAdapter Rando 100 -
DataMapper::Adapters::DataObjectsAdapter Rando 100 Needs Docs
DataMapper::Property antares, carllerche 80 Moving property specs to a shared spec group for combining Types and Property. Needs decision on whether pending examples make sense to specify
DataMapper::Query dkubb 70 Speccing